home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Toolbox / Visual Basic Toolbox (P.I.E.)(1996).ISO / network / publiccc / genesis.bas next >
BASIC Source File  |  1994-10-09  |  71KB  |  2,536 lines

  1. 'global defs and types are in globals.bas
  2.  
  3. Sub add_delete_letter (current_form As Form, ByVal cap_st As String, ByVal r_st As String)
  4.  
  5. 'add the delete statment to the caption of the passed form
  6.  
  7. screen_width% = ((current_form.Width / 1440) * 12) - 10
  8.  
  9. If screen_width% Mod 2 = 0 Then
  10.     'even length
  11.     screen_width% = screen_width% - 1
  12. End If
  13.  
  14. ReDim cap_array(screen_width%)
  15. For i = 1 To screen_width%    'load the array with blanks
  16.     cap_array(i) = Chr$(160)
  17. Next i
  18.  
  19. 'MsgBox "cap_st$ " + cap_st$
  20.  
  21. 'load existing caption into array
  22. For i = 1 To Len(cap_st$)
  23.     cap_array(i) = Mid$(cap_st$, i, 1)
  24. Next i
  25.  
  26. 'put delete marker in caption array
  27. start_pos% = (screen_width% - Len(r_st$)) + 1
  28.  
  29. For i = 1 To Len(r_st$)
  30.     cap_array(start_pos%) = Mid$(r_st$, i, 1)
  31.     start_pos% = start_pos% + 1
  32. Next i
  33.  
  34. cap_st$ = ""
  35. For i = 1 To screen_width%
  36.     cap_st$ = cap_st$ + cap_array(i)
  37. Next i
  38. current_form.Caption = cap_st$
  39.  
  40. End Sub
  41.  
  42. Sub add_three_part_caption (current_form As Form, ByVal l_st As String, ByVal m_st As String, ByVal r_st As String)
  43. 'screen_width% = ((current_form.Width / 1440) * 12) - 10
  44. screen_width% = 53
  45.  
  46. If screen_width% Mod 2 = 0 Then
  47.     'even length
  48.     screen_width% = screen_width% - 1
  49. End If
  50.  
  51. ReDim cap_array(screen_width%)
  52. For i = 1 To screen_width%    'load the array with blanks
  53.     cap_array(i) = Chr$(160)
  54. Next i
  55.  
  56. 'put left part in array
  57. For i = 1 To Len(l_st$)
  58.     cap_array(i) = Mid$(l_st$, i, 1)
  59. Next i
  60.  
  61. 'put middle in array
  62. If Len(m_st$) Mod 2 = 0 Then
  63.     is_even = True
  64. Else
  65.     is_even = False
  66. End If
  67.  
  68. If is_even Then
  69.     start_pos% = (Int(screen_width% / 2) - Int(Len(m_st$) / 2)) + 1
  70. Else
  71.     start_pos% = Int(screen_width% / 2) - Int(Len(m_st$) / 2)
  72. End If
  73. For i = 1 To Len(m_st$)
  74.     cap_array(start_pos%) = Mid$(m_st$, i, 1)
  75.     start_pos% = start_pos% + 1
  76. Next i
  77.  
  78. 'put right part in array
  79. start_pos% = (screen_width% - Len(r_st$)) + 1
  80. For i = 1 To Len(r_st$)
  81.     cap_array(start_pos%) = Mid$(r_st$, i, 1)
  82.     start_pos% = start_pos% + 1
  83. Next i
  84.  
  85. 'build caption string
  86. cap_st$ = ""
  87. For i = 1 To screen_width%
  88.     cap_st$ = cap_st$ + cap_array(i)
  89. Next i
  90.  
  91. cap_st$ = replace_blanks(cap_st$)
  92. current_form.Caption = cap_st$
  93.     
  94. hold_st$ = cap_st$
  95.  
  96. End Sub
  97.  
  98. Function backup_file (source As String, dest As String, error_num As Integer, nonex As Integer)
  99. error_num = 0
  100. backup_file = False
  101.  
  102. On Error GoTo copy_err
  103.  
  104. If nonex% = 0 Then  'non exclusive is NOT checked
  105.     fnumber = FreeFile
  106.     Open source$ For Input As fnumber
  107.     Close fnumber
  108. End If
  109.     
  110. If file_exists(dest$) Then
  111.     If Not kill_file(dest$) Then
  112.     GoTo copy_err
  113.     End If
  114. End If
  115.  
  116. FileCopy source$, dest$
  117. backup_file = True
  118. Exit Function
  119.  
  120. copy_err:
  121. error_num = Err
  122. Exit Function
  123.      
  124. End Function
  125.  
  126. Function build_anal5 (cmd As String) As Integer
  127.  
  128.     po_path$ = anal5.Combo1.Text
  129.     cmd$ = ini_array(6).setting + "analyze" + " " + "/d" + po_path$
  130.     If anal5.Text4.Text <> "" And anal5.Text4.Enabled Then
  131.     cmd$ = cmd$ + " /n" + Chr$(34) + anal5.Text4.Text + Chr$(34)
  132.     ElseIf anal5.Check5.Value = 1 Then    '/users
  133.     cmd$ = cmd$ + " /users"
  134.     ElseIf anal5.List1.Text <> "" Then
  135.     cmd$ = cmd$ + " /usr/" + Mid(anal5.List1.Text, 4, Len(anal5.List1.Text) - 3)
  136.     End If
  137.     If anal5.Check1.Value = 1 Then
  138.     cmd$ = cmd$ + " /batch"
  139.     End If
  140.     If anal5.Check2.Value = 1 Then
  141.     cmd$ = cmd$ + " /diagnostics"
  142.     End If
  143.     If anal5.Check3.Value = 1 Then
  144.     cmd$ = cmd$ + " /directory"
  145.     End If
  146.     If anal5.Check4.Value = 1 Then
  147.     cmd$ = cmd$ + " /messages"
  148.     End If
  149.  
  150.     If cmd$ <> "" Then
  151.     build_anal5 = True
  152.     Else
  153.     build_anal5 = False
  154.     End If
  155.  
  156. End Function
  157.  
  158. Sub build_combo_list (f As Form)
  159.     
  160.     'add default po to top of list
  161.     ret_st$ = String$(256, " ")
  162.     x% = GetPrivateProfileString("Default_PO", "Default_PO", "None", ret_st$, Len(ret_st$), INI_FILE)
  163.     If InStr(ret_st$, "none") = 0 Then
  164.     'strip po_path from full string containing po_name and po_password seperated by ]
  165.     ret_st$ = trim_null(ret_st$)
  166.     x% = InStr(ret_st$, "]")
  167.     If x% <> 0 Then
  168.         If Mid$(ret_st$, x% - 1, 1) = "\" Then  'strip \ off
  169.         'ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  170.         x% = x% - 1 'dont take '\' at end
  171.         End If
  172.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  173.         f.Combo1.AddItem ret_st$
  174.     Else
  175.         f.Combo1.AddItem ret_st$
  176.     End If
  177.     End If
  178.  
  179.     ret_st$ = String$(256, " ")
  180.     x% = GetPrivateProfileString("prev_po", "po1", "none", ret_st$, Len(ret_st$), INI_FILE)
  181.     If InStr(ret_st$, "none") = 0 Then
  182.     'strip po_path from full string containing po_name and po_password seperated by ]
  183.     ret_st$ = trim_null(ret_st$)
  184.     x% = InStr(ret_st$, "]")
  185.     If x% <> 0 Then
  186.         If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then    'strip \ off of end if present
  187.         ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  188.         End If
  189.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  190.         f.Combo1.AddItem ret_st$
  191.     Else
  192.         f.Combo1.AddItem ret_st$
  193.     End If
  194.     End If
  195.  
  196.     ret_st$ = String$(256, " ")
  197.     x% = GetPrivateProfileString("prev_po", "po2", "none", ret_st$, Len(ret_st$), INI_FILE)
  198.     If InStr(ret_st$, "none") = 0 Then
  199.     'strip po_path from full string containing po_name and po_password seperated by ]
  200.     ret_st$ = trim_null(ret_st$)
  201.     x% = InStr(ret_st$, "]")
  202.     If x% <> 0 Then
  203.         If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then    'strip \ off of end if present
  204.         ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  205.         End If
  206.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  207.         f.Combo1.AddItem ret_st$
  208.     Else
  209.         f.Combo1.AddItem ret_st$
  210.     End If
  211.     End If
  212.     
  213.     ret_st$ = String$(256, " ")
  214.     x% = GetPrivateProfileString("prev_po", "po3", "none", ret_st$, Len(ret_st$), INI_FILE)
  215.     If InStr(ret_st$, "none") = 0 Then
  216.     'strip po_path from full string containing po_name and po_password seperated by ]
  217.     ret_st$ = trim_null(ret_st$)
  218.     x% = InStr(ret_st$, "]")
  219.     If x% <> 0 Then
  220.         If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then    'strip \ off of end if present
  221.         ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  222.         End If
  223.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  224.         f.Combo1.AddItem ret_st$
  225.     Else
  226.         f.Combo1.AddItem ret_st$
  227.     End If
  228.     End If
  229.  
  230.     ret_st$ = String$(256, " ")
  231.     x% = GetPrivateProfileString("prev_po", "po4", "none", ret_st$, Len(ret_st$), INI_FILE)
  232.     If InStr(ret_st$, "none") = 0 Then
  233.     'strip po_path from full string containing po_name and po_password seperated by ]
  234.     ret_st$ = trim_null(ret_st$)
  235.     x% = InStr(ret_st$, "]")
  236.     If x% <> 0 Then
  237.         If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then    'strip \ off of end if present
  238.         ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  239.         End If
  240.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  241.         f.Combo1.AddItem ret_st$
  242.     Else
  243.         f.Combo1.AddItem ret_st$
  244.     End If
  245.     End If
  246.     
  247.     ret_st$ = String$(256, " ")
  248.     x% = GetPrivateProfileString("prev_po", "po5", "none", ret_st$, Len(ret_st$), INI_FILE)
  249.     If InStr(ret_st$, "none") = 0 Then
  250.     'strip po_path from full string containing po_name and po_password seperated by ]
  251.     ret_st$ = trim_null(ret_st$)
  252.     x% = InStr(ret_st$, "]")
  253.     If x% <> 0 Then
  254.         If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then    'strip \ off of end if present
  255.         ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  256.         End If
  257.         ret_st$ = Mid$(ret_st$, 1, x% - 1)
  258.         f.Combo1.AddItem ret_st$
  259.     Else
  260.         f.Combo1.AddItem ret_st$
  261.     End If
  262.     End If
  263.     
  264. End Sub
  265.  
  266. Sub build_ini_array ()
  267. 'builds ini_array which hold the INI_FILE info
  268. 'The structure is:
  269. 'Type ini_info
  270. '    AppName As String       'Section in manager.ini e.g [Welcome]
  271. '    KeyName As String       'Name in section - e.g. Welcome_Screen
  272. '    Default As String       'default value for entry
  273. '    Setting As String       'value read next to keyname (read in)
  274. 'End Type
  275.  
  276.     'ini_array is defined as follows
  277.     '(1) = Welcome Screen True or False
  278.     '(2) = Default PO for program - full path name
  279.     '(3) = not used
  280.     '(4) = default Backup destination - full path name
  281.     '(5) = Def PO Name
  282.     '(6) = Directory location of admin programs - full path name
  283.     '(7) = Administrators cc:Mail User name
  284.     '(8) = PO Password
  285.     '(9) = User password placed here during execution of program
  286.     '(10) = Product registered to
  287.     '(11) = Company name - ok if blank
  288.     '(12) = Program directory
  289.     '(13) = default cmd directory
  290.     '(14) = if "true" then lock pc during batch file execution
  291.     '(15) = if "true" then first time running program - open demo.cmd
  292.     
  293.     ReDim ini_array(16)
  294.  
  295.     ret_st$ = String$(256, " ")
  296.     x% = GetPrivateProfileString("Welcome_Screen", "Welcome_Screen", "None", ret_st$, Len(ret_st$), INI_FILE)
  297.     ini_array(1).appname = "Welcome_Screen"
  298.     ini_array(1).keyname = "Welcome_Screen"
  299.     ini_array(1).default = "true"
  300.     If InStr(ret_st$, "None") Then
  301.     'manager.ini not there
  302.     show_error (3) 'stop program manager.ini missing
  303.     End
  304.     End If
  305.     If InStr(ret_st$, "true") Then
  306.     ini_array(1).setting = "true"
  307.     Else
  308.     ini_array(1).setting = "false"
  309.     End If
  310.     
  311.     ret_st$ = String$(256, " ")
  312.     x% = GetPrivateProfileString("Default_PO", "default_po", "None", ret_st$, Len(ret_st$), INI_FILE)
  313.     ini_array(2).appname = "default_po"
  314.     ini_array(2).keyname = "default_po"
  315.     ini_array(2).default = "None"
  316.     ret_st$ = trim_null(ret_st$)
  317.     ret_st$ = get_string(ret_st$, "]", 1)       'get first part of default_po which is the path to the default PO
  318.     If Mid$(ret_st$, Len(ret_st$), 1) = "\" Then
  319.     ret_st$ = Mid$(ret_st$, 1, Len(ret_st$) - 1)
  320.     End If
  321.     ini_array(2).setting = ret_st$
  322.     
  323.     ret_st$ = String$(256, " ")
  324.     x% = GetPrivateProfileString("Def_Back", "Def_Back", "None", ret_st$, Len(ret_st$), INI_FILE)
  325.     ini_array(4).appname = "Def_Back"
  326.     ini_array(4).keyname = "Def_Back"
  327.     ini_array(4).default = "None"
  328.     ini_array(4).setting = trim_null(ret_st$)
  329.  
  330.     ret_st$ = String$(256, " ")
  331.     x% = GetPrivateProfileString("default_po", "default_po", "None", ret_st$, Len(ret_st$), INI_FILE)
  332.     ini_array(5).appname = "default_po"
  333.     ini_array(5).keyname = "default_po"
  334.     ini_array(5).default = "None"
  335.     ret_st$ = trim_null(ret_st$)
  336.     ret_st$ = get_string(ret_st$, "]", 2)       'get first part of po_name which is the path to the default PO
  337.     ini_array(5).setting = ret_st$
  338.     
  339.     ret_st$ = String$(256, " ")
  340.     x% = GetPrivateProfileString("Admin_Dir", "Admin_Dir", "None", ret_st$, Len(ret_st$), INI_FILE)
  341.     ini_array(6).appname = "Admin_Dir"
  342.     ini_array(6).keyname = "Admin_Dir"
  343.     ini_array(6).default = "None"
  344.     ini_array(6).setting = trim_null(ret_st$)
  345.  
  346.     ret_st$ = String$(256, " ")
  347.     x% = GetPrivateProfileString("default_po", "default_po", "None", ret_st$, Len(ret_st$), INI_FILE)
  348.     ini_array(8).appname = "default_po"
  349.     ini_array(8).keyname = "default_po"
  350.     ini_array(8).default = "None"
  351.     ret_st$ = trim_null(ret_st$)
  352.     ret_st$ = get_string(ret_st$, "]", 3)       'get first part of po password which is the path to the default PO
  353.     ini_array(8).setting = ret_st$
  354.    
  355.     ret_st$ = String$(256, " ")
  356.     x% = GetPrivateProfileString("User_Name", "User_Name", "None", ret_st$, Len(ret_st$), INI_FILE)
  357.     ini_array(10).appname = "User_Name"
  358.     ini_array(10).keyname = "User_Name"
  359.     ini_array(10).default = "None"
  360.     ini_array(10).setting = trim_null(ret_st$)
  361.     
  362.     ret_st$ = String$(256, " ")
  363.     x% = GetPrivateProfileString("Company", "Company", " ", ret_st$, Len(ret_st$), INI_FILE)
  364.     ini_array(11).appname = "Company"
  365.     ini_array(11).keyname = "Company"
  366.     ini_array(11).default = " "
  367.     ini_array(11).setting = trim_null(ret_st$)
  368.     
  369.     ret_st$ = String$(256, " ")
  370.     x% = GetPrivateProfileString("Prog_Dir", "Prog_Dir", "c:\manager\", ret_st$, Len(ret_st$), INI_FILE)
  371.     ini_array(12).appname = "Prog_Dir"
  372.     ini_array(12).keyname = "Prog_Dir"
  373.     ini_array(12).default = "c:\manager\manager.dat"
  374.     ini_array(12).setting = trim_null(ret_st$)
  375.  
  376.     filename$ = ini_array(12).setting + "manager.dat"
  377.     
  378.     If file_exists(filename$) Then
  379.     file_num = FreeFile
  380.     Open filename$ For Input As #file_num
  381.     Else
  382.  
  383.     Call show_error(1)
  384.     End
  385.     End If
  386.     Line Input #file_num, ret_st$
  387.     Close #file_num
  388.     
  389.     ini_array(9).appname = "Password"
  390.     ini_array(9).keyname = "Password"
  391.     ini_array(9).default = "None"
  392.     ini_array(9).setting = Trim$(ret_st$)
  393.     
  394.     ret_st$ = String$(256, " ")
  395.     x% = GetPrivateProfileString("Def_cmd_Dir", "Def_cmd_Dir", "c:\", ret_st$, Len(ret_st$), INI_FILE)
  396.     ini_array(13).appname = "Def_cmd_Dir"
  397.     ini_array(13).keyname = "Def_cmd_Dir"
  398.     ini_array(13).default = "c:\"
  399.     ini_array(13).setting = trim_null(ret_st$)
  400.  
  401.  
  402.     ret_st$ = String$(256, " ")
  403.     x% = GetPrivateProfileString("lock_pc", "lock_pc", "None", ret_st$, Len(ret_st$), INI_FILE)
  404.     ini_array(14).appname = "lock_pc"
  405.     ini_array(14).keyname = "lock_pc"
  406.     ini_array(14).default = "true"
  407.     If InStr(ret_st$, "true") Then
  408.     ini_array(14).setting = "true"
  409.     Else
  410.     ini_array(14).setting = "false"
  411.     End If
  412.     lock_pc = False
  413.     If ini_array(14).setting = "true" Then lock_pc = True
  414.     
  415.     ret_st$ = String$(256, " ")
  416.     x% = GetPrivateProfileString("First_Time", "First_Time", "None", ret_st$, Len(ret_st$), INI_FILE)
  417.     ini_array(15).appname = "First_Time"
  418.     ini_array(15).keyname = "First_Time"
  419.     ini_array(15).default = "false"
  420.     If InStr(ret_st$, "true") Then
  421.     ini_array(15).setting = "true"
  422.     Else
  423.     ini_array(15).setting = "false"
  424.     End If
  425.  
  426.     ret_st$ = String$(256, " ")
  427.     x% = GetPrivateProfileString("Language", "Language", "None", ret_st$, Len(ret_st$), INI_FILE)
  428.     ini_array(16).appname = "Language"
  429.     ini_array(16).keyname = "Language"
  430.     ini_array(16).default = "false"
  431.     ini_array(16).setting = trim_null(ret_st$)
  432.     
  433. End Sub
  434.  
  435. Function build_one_file () As String
  436.  
  437. build_one_file = ""
  438. return_string$ = ""
  439.  
  440. For i = 1 To last_line
  441.     found_command = True
  442.     st$ = cmdline(i).Panel3D1.Caption  'ccmail command
  443.     If InStr(1, st$, "Super ChkStat") <> 0 Then
  444.     found_command = False
  445.     End If
  446.     If InStr(1, st$, "Backup Options") <> 0 Then
  447.     found_command = False
  448.     End If
  449.     If InStr(1, st$, "ChkStat Options") <> 0 Then
  450.     found_command = False
  451.     End If
  452.     If InStr(1, st$, "Reclaim Options") <> 0 Then
  453.     found_command = False
  454.     End If
  455.  
  456.     If found_command Then
  457.     return_string$ = return_string$ + st$ + crlf$
  458.     End If
  459.     
  460. Next i
  461. build_one_file = return_string$
  462.  
  463. End Function
  464.  
  465. Sub center_form (form_name As Form, vertical_center As Integer)
  466.     'centers a form on the screen.
  467.     'if vertical_center then just center horizontally
  468.  
  469.     If window_state = 0 Then
  470.     If vertical_center = 1 Then
  471.         form_name.Move (screen.Width - form_name.Width) / 2
  472.         
  473.     Else
  474.         form_name.Move (screen.Width - form_name.Width) / 2, (screen.Height - form_name.Height) / 2
  475.         
  476.     End If
  477.     End If
  478. End Sub
  479.  
  480. Sub check_combo1_list (f As Form, ByVal po_path As String, ByVal po_name As String, ByVal po_password As String)
  481.  
  482. '8/21/94 - htm
  483. 'this procedure checks to see if added po in combo list is already in list and if not then adds it to the list
  484. 'and writes the new po out to the manager.ini file under the key [prev_po].  ini file delmiter = ]
  485. 'if analyze running then po_name and po_password are passed as null
  486.  
  487.     If po_path$ = "" Then Exit Sub
  488.     If Mid$(po_path$, Len(po_path$), 1) = "\" Then po_path$ = Mid$(po_path$, 1, Len(po_path$) - 1)
  489.     
  490.     x% = f.Combo1.ListCount - 1  'how many items
  491.  
  492.     For i = 0 To x%
  493.  
  494.     'First check if \ in combo1.list(i) path, if so then take it off to normalize compare
  495.     'take off \ if at end of path (e.g. default_po has this)
  496.  
  497.     ch$ = Mid$(f.Combo1.List(i), Len(f.Combo1.List(i)), 1)
  498.     If ch$ = "\" Then
  499.         comp_st$ = Mid$(f.Combo1.List(i), 1, Len(f.Combo1.List(i)) - 1)
  500.     Else
  501.         comp_st$ = f.Combo1.List(i)
  502.     End If
  503.  
  504.     If LCase$(po_path$) = LCase$(comp_st$) Then
  505.         'found it now set the combo box to it
  506.         f.Combo1.ListIndex = i
  507.         Exit Sub
  508.     End If
  509.     Next
  510.  
  511.     'did not find it
  512.     f.Combo1.AddItem po_path$
  513.     f.Combo1.ListIndex = f.Combo1.ListCount - 1
  514.     
  515.     'read in first four so you can move them down
  516.     ret_st$ = String$(256, " ")
  517.     x% = GetPrivateProfileString("prev_po", "po1", "none", ret_st$, Len(ret_st$), INI_FILE)
  518.     po1$ = trim_null(ret_st$)
  519.     If Mid$(po1$, Len(po1$), 1) = "\" Then po1$ = Mid$(po1$, 1, Len(po1$) - 1)
  520.  
  521.     ret_st$ = String$(256, " ")
  522.     x% = GetPrivateProfileString("prev_po", "po2", "none", ret_st$, Len(ret_st$), INI_FILE)
  523.     po2$ = trim_null(ret_st$)
  524.     If Mid$(po2$, Len(po2$), 1) = "\" Then po2$ = Mid$(po2$, 1, Len(po2$) - 1)
  525.  
  526.     ret_st$ = String$(256, " ")
  527.     x% = GetPrivateProfileString("prev_po", "po3", "none", ret_st$, Len(ret_st$), INI_FILE)
  528.     po3$ = trim_null(ret_st$)
  529.     If Mid$(po3$, Len(po3$), 1) = "\" Then po3$ = Mid$(po3$, 1, Len(po3$) - 1)
  530.  
  531.     ret_st$ = String$(256, " ")
  532.     x% = GetPrivateProfileString("prev_po", "po4", "none", ret_st$, Len(ret_st$), INI_FILE)
  533.     po4$ = trim_null(ret_st$)
  534.     If Mid$(po4$, Len(po4$), 1) = "\" Then po4$ = Mid$(po4$, 1, Len(po4$) - 1)
  535.     
  536.     'now re-write list in ini file
  537.     If WritePrivateProfileString("prev_po", "po2", po1$, INI_FILE) = 0 Then
  538.     MsgBox "Unable to write profile string", 48, ini_array(1).appname
  539.     End If
  540.     If WritePrivateProfileString("prev_po", "po3", po2$, INI_FILE) = 0 Then
  541.     MsgBox "Unable to write profile string", 48, ini_array(1).appname
  542.     End If
  543.     If WritePrivateProfileString("prev_po", "po4", po3$, INI_FILE) = 0 Then
  544.     MsgBox "Unable to write profile string", 48, ini_array(1).appname
  545.     End If
  546.     If WritePrivateProfileString("prev_po", "po5", po4$, INI_FILE) = 0 Then
  547.     MsgBox "Unable to write profile string", 48, ini_array(1).appname
  548.     End If
  549.  
  550.     ini_st$ = po_path$ + "]" + po_name$ + "]" + po_password$
  551.     If WritePrivateProfileString("prev_po", "po1", ini_st$, INI_FILE) = 0 Then
  552.     MsgBox "Unable to write profile string", 48, ini_array(1).appname
  553.     End If
  554.     
  555. End Sub
  556.  
  557. Sub check_pass_file (ByVal file_num As Integer)
  558.  
  559. On Error GoTo err_in
  560.     
  561.     Open fname For Input As #file_num
  562.     
  563.     Exit Sub
  564.  
  565. err_in:
  566.  
  567.     MsgBox "No password file found"
  568.     End
  569.  
  570. End Sub
  571.  
  572. Function check_resource () As Integer
  573.     
  574.     'checks to see if the language resource is out there
  575.     'ini_array(16) reads the .ri file from manager.ini
  576.     
  577.     check_resource = False
  578.     st$ = ini_array(6).setting + ini_array(16).setting
  579.     If Not file_exists(st$) Then
  580.     MsgBox "Could not find: " + st$, 48, "Utility Program Error"
  581.     Else
  582.     check_resource = True
  583.     End If
  584.     
  585. End Function
  586.  
  587. Sub clear_box ()
  588.         cmdline(current_line).Line (1920, 960)-(5520, 2400), QBColor(7), BF
  589.         cmdline(current_line).DrawWidth = 2
  590.         cmdline(current_line).Line (1920, 960)-(5520, 960), QBColor(8)       'top
  591.         cmdline(current_line).Line (1920, 960)-(1920, 2400), QBColor(15)       'left
  592.         cmdline(current_line).Line (5520, 960)-(5520, 2400), QBColor(8)       'right
  593.         cmdline(current_line).Line (1920, 2400)-(5520, 2400), QBColor(15)     'bottom
  594.  
  595. End Sub
  596.  
  597. Sub close_current_file ()
  598.  
  599.     For i = 1 To last_line
  600.     Unload cmdline(i)
  601.     Next i
  602.     last_line = 1
  603.     current_line = 1
  604.     ReDim cmdline(256)
  605.     
  606.  
  607.  
  608. End Sub
  609.  
  610. Function copy_it (source As String, dest As String) As Integer
  611. copy_it = False
  612.  
  613. On Error GoTo copy_error
  614.  
  615. If file_exists(source$) Then
  616.     If Not kill_file(dest$) Then
  617.     GoTo copy_error
  618.     End If
  619. End If
  620.  
  621. FileCopy source$, dest$
  622. copy_it = True
  623. Exit Function
  624.  
  625. copy_error:
  626. copy_it = Err
  627.  
  628. Exit Function
  629.  
  630.  
  631. End Function
  632.  
  633. Sub copy_my_file (source As String, dest As String)
  634.  
  635. On Error GoTo copy_my
  636. FileCopy source$, dest$
  637. Exit Sub
  638.  
  639. copy_my:
  640. Exit Sub
  641.  
  642. End Sub
  643.  
  644. Sub do_cmdline_backup (cmd_st As String)
  645. 'parse out backup batch file command and execute from windows
  646.     Call post_message("Running Backup...")
  647.     do_usr_files = False
  648.     do_mlandata = False
  649.     do_clandata = False
  650.     source$ = ""
  651.     destination$ = ""
  652.  
  653.     'If InStr(1, cmd_st$, "for") > 0 Then 'usr files
  654.     If InStr(1, cmd_st$, "usr?????") > 0 Then 'usr files
  655.     do_usr_files = True
  656.     End If
  657.     If InStr(1, cmd_st$, "mlandata") > 0 Then 'mlandata
  658.     do_mlandata = True
  659.     End If
  660.     If InStr(1, cmd_st$, "clandata") > 0 Then   'clandata
  661.     do_clandata = True
  662.     End If
  663.  
  664.     'now get source and destination paths
  665.     If InStr(1, cmd_st$, "mlandata") > 0 Then
  666.     temp$ = ""
  667.     ch$ = ""
  668.     i = 1
  669.     Do
  670.         temp$ = temp$ + ch$
  671.         ch$ = Mid$(cmd_st$, i + 5, 1)
  672.         i = i + 1
  673.     Loop Until ch$ = Chr$(32)
  674.     
  675.     st2$ = Mid$(cmd_st$, i + 5, Len(cmd_st$) - i + 1)   'for finding destination
  676.     x% = InStr(1, st2$, Chr$(13))
  677.     If x% = 0 Then
  678.         temp2$ = st2$
  679.     Else
  680.         end_pos% = x% - 1
  681.         temp2$ = Mid$(st2$, 1, end_pos%)
  682.     End If
  683.     
  684.     destination$ = temp2$
  685.  
  686.     x% = InStr(1, temp$, "mlandata")
  687.     temp$ = Mid$(temp$, 1, x% - 1)
  688.     source$ = temp$
  689.     
  690.     ElseIf InStr(1, cmd_st$, "clandata") > 0 Then
  691.     temp$ = ""
  692.     ch$ = ""
  693.     i = 1
  694.     Do
  695.         temp$ = temp$ + ch$
  696.         ch$ = Mid$(cmd_st$, i + 5, 1)
  697.         i = i + 1
  698.     Loop Until ch$ = Chr$(32)
  699.     st2$ = Mid$(cmd_st$, i + 5, Len(cmd_st$) - i + 1)   'for finding destination
  700.     x% = InStr(1, st2$, Chr$(13))
  701.     If x% = 0 Then
  702.         temp2$ = st2$
  703.     Else
  704.         end_pos% = x% - 1
  705.         temp2$ = Mid$(st2$, 1, end_pos%)
  706.     End If
  707.     destination$ = temp2$
  708.     
  709.     x% = InStr(1, temp$, "clandata")
  710.     temp$ = Mid$(temp$, 1, x% - 1)
  711.     source$ = temp$
  712.     ElseIf InStr(1, cmd_st$, "usr?????") > 0 Then 'usr files
  713.     start_pos% = 13
  714.     end_pos% = InStr(1, cmd_st$, "usr") - 1
  715.     temp$ = Mid$(cmd_st$, start_pos%, end_pos% - start_pos% + 1)
  716.     source$ = temp$
  717.     
  718.     start_pos% = InStr(1, cmd_st$, "copy %%") + 9
  719.     end_pos% = InStr(1, cmd_st$, "usr????? >>") - 1
  720.     temp$ = Mid$(cmd_st$, start_pos%, end_pos% - start_pos% + 1)
  721.     destination$ = temp$
  722.  
  723.     End If
  724.  
  725.     If source$ = "" Then Exit Sub
  726.     If destination$ = "" Then Exit Sub
  727.  
  728.     If Not kill_file(outfile$) Then
  729.     End If
  730.     
  731.     filenum = open_for_output(outfile$)
  732.     If filenum = 0 Then
  733.     Exit Sub
  734.     End If
  735.     timestamp = Now
  736.     st$ = "Backup Report: " + crlf$
  737.     st$ = st$ + "Created on " + Format(timestamp, "mm/dd/yy") + " at " + Format(timestamp, "h:mm:ss AM/PM") + crlf$
  738.     Print #filenum, st$
  739.     st$ = "Source Post Office Directory: " + source$ + crlf$ + crlf$
  740.     Print #filenum, st$
  741.     st$ = "The following files were copied to: " + destination$ + crlf$
  742.     Print #filenum, st$
  743.     st$ = "  File                           Bytes" + crlf$
  744.     Print #filenum, st$
  745.     
  746.     On Error GoTo err_backup
  747.  
  748.     Load newstatus
  749.     newstatus.Panel3D1.FloodPercent = 1
  750.     newstatus.Caption = BACKUP + " In Progress..."
  751.     Call center_form(newstatus, 0)
  752.     newstatus.Show
  753.     newstatus.Refresh
  754.     done% = 0
  755.     total_done% = 0
  756.     
  757.     If do_clandata Then
  758.     total_done% = 1
  759.     End If
  760.     If do_usr_files Then
  761.     cmdline(current_line).File1.Path = source$
  762.     cmdline(current_line).File1.Pattern = "USR?????.*"
  763.     total_done% = total_done% + cmdline(current_line).File1.ListCount
  764.     End If
  765.     If do_mlandata Then
  766.     total_done% = total_done% + 1
  767.     End If
  768.  
  769.     If do_clandata Then  'backup clandata
  770.     FileCopy source$ + "clandata.", destination$ + "\" + "clandata"
  771.     done% = done% + 1
  772.     newstatus.Panel3D1.FloodPercent = (done% / total_done%) * 100
  773.     x% = DoEvents()
  774.     Print #filenum, "clandata" + Space(25) + Str$(FileLen(source$ + "clandata"))
  775.     End If
  776.  
  777.     If do_usr_files = True Then    'copy usr???? files
  778.     cmdline(current_line).File1.Path = source$
  779.     cmdline(current_line).File1.Pattern = "USR?????.*"
  780.     For i = 0 To cmdline(current_line).File1.ListCount - 1
  781.         file_name = cmdline(current_line).File1.List(i)
  782.         FileCopy source$ + file_name, destination$ + "\" + file_name
  783.         done% = done% + 1
  784.         newstatus.Panel3D1.FloodPercent = (done% / total_done%) * 100
  785.         x% = DoEvents()
  786.         Print #filenum, file_name + Space(25) + Str$(FileLen(source$ + file_name))
  787.     Next i
  788.     End If
  789.  
  790.     If do_mlandata Then   'backup mlandata
  791.     FileCopy source$ + "mlandata.", destination$ + "\" + "mlandata"
  792.     done% = done% + 1
  793.     newstatus.Panel3D1.FloodPercent = (done% / total_done%) * 100
  794.     x% = DoEvents()
  795.     Print #filenum, "mlandata" + Space(25) + Str$(FileLen(source$ + "mlandata"))
  796.     End If
  797.  
  798.     Print #filenum, crlf$ + crlf$
  799.     Print #filenum, "Backup Process Successful"
  800.     Close #filenum
  801.     Unload newstatus
  802.     GoTo the_end
  803.  
  804. err_backup:
  805.     Unload batchgauge
  806.     st$ = cmdline(current_line).Tag
  807.     st$ = "Frame: " + pad_it(st$)
  808.     post_message (st$)
  809.     Exit Sub
  810.  
  811. the_end:
  812.     cmdline(current_line).buttons(4).Enabled = True
  813.     st$ = cmdline(current_line).Tag
  814.     st$ = "Frame: " + pad_it(st$)
  815.     post_message (st$)
  816.  
  817. End Sub
  818.  
  819. Function encrypt (ByVal in_st As String, shift As Integer) As String
  820. 'encrypts using simple shifted array
  821.  
  822.  
  823. in_st$ = transpose(in_st$)
  824.  
  825. Dim trans() As String
  826. ReDim trans(95, 2) As String
  827.  
  828. x% = 1
  829. For i% = 32 To 126
  830.     trans(x%, 1) = Chr$(i%)
  831.     x% = x% + 1
  832. Next i%
  833.  
  834. x% = shift%
  835. For i% = 32 To (126 - (shift% - 1))     '116
  836.     trans(x%, 2) = Chr$(i%)
  837.     x% = x% + 1
  838. Next i%
  839.  
  840. x% = 1
  841. For i% = (126 - (shift% - 2)) To 126        '117
  842.     trans(x%, 2) = Chr$(i%)
  843.     x% = x% + 1
  844. Next i%
  845.  
  846. out_st$ = ""
  847. For i% = 1 To Len(in_st$)
  848.     x% = 0
  849.     match% = 0
  850.     ch$ = Mid$(in_st$, i%, 1)
  851.     Do
  852.     x% = x% + 1
  853.     match_ch$ = trans(x%, 1)
  854.     If match_ch$ = ch$ Then
  855.         match% = 1
  856.     End If
  857.     Loop Until match% = 1
  858.     out_st$ = out_st$ + trans(x%, 2)
  859. Next i%
  860.  
  861. encrypt = out_st$
  862.  
  863. End Function
  864.  
  865. Sub end_program ()
  866.         
  867.         End 'Exit selected
  868.  
  869. End Sub
  870.  
  871. Function file_exists (fname As String) As Integer
  872.     file_exists = False
  873.     On Error GoTo err_exists
  874.     fnum = FreeFile
  875.     Open fname For Input As fnum
  876.     file_exists = True
  877.     Close fnum
  878.     Exit Function
  879.  
  880. err_exists:
  881.     Close fnum
  882.     Exit Function
  883.  
  884. End Function
  885.  
  886. Function find_user_info (fname As String, username As String, compname As String) As Integer
  887.  
  888. find_user_info = False
  889. program% = FreeFile
  890.  
  891. Open fname$ For Binary As #program%
  892.  
  893.     st$ = String$(50, " ")
  894.     Get #program%, 80, st$
  895.     
  896.     username$ = Mid$(st$, 1, 25)
  897.     compname$ = Mid$(st$, 26, 25)
  898.     
  899.     username$ = remove_blanks(username$)
  900.     
  901.     compname$ = remove_blanks(compname$)
  902.  
  903.     find_user_info = True
  904.  
  905. End Function
  906.  
  907. Function get_mess (st As String, param As String, start_pos As Integer, end_pos As Integer) As Integer
  908.     get_mess = False
  909.  
  910.     start_pos% = InStr(st$, param$)
  911.     If start_pos% > 0 Then
  912.     get_mess = True
  913.     end_pos% = InStr(start_pos% + 1, st$, "/")
  914.     If end_pos% = start_pos% Or end_pos% = 0 Then
  915.         end_pos% = Len(st$)     'no more "/"
  916.     Else
  917.         end_pos% = end_pos% - 1
  918.     End If
  919.     End If
  920.  
  921. End Function
  922.  
  923. Function get_outfile () As String
  924.  
  925.     get_outfile = ""
  926.     tag_st$ = cmdline(current_line).Tag
  927.     tag_st$ = Trim$(tag_st$)
  928.     pad$ = String$(3 - Len(tag_st$), "0")
  929.     tag_st$ = pad$ + tag_st$
  930.     suffix$ = Mid$(fname$, 1, Len(fname$) - 3)
  931.     get_outfile$ = LCase$(suffix$ + tag_st$)
  932.     
  933. End Function
  934.  
  935. Function get_outfile2 () As String
  936.     get_outfile2 = ""
  937.     tag_st$ = cmdline(last_line).Tag
  938.     tag_st$ = Trim$(tag_st$)
  939.     pad$ = String$(3 - Len(tag_st$), "0")
  940.     tag_st$ = pad$ + tag_st$
  941.     suffix$ = Mid$(fname$, 1, Len(fname$) - 3)
  942.     get_outfile2 = LCase$(suffix$ + tag_st$)
  943.  
  944. End Function
  945.  
  946. Sub get_poname_passwd (combo As Control, po_path As String, po_name As String, po_passwd As String)
  947. 'Stop
  948. po_passwd$ = ""
  949. po_name$ = ""
  950.  
  951. found = False
  952. profile$ = ""
  953.  
  954. If InStr(combo.List(0), po_path) > 0 Then
  955.     found = True
  956.     profile$ = "Default_PO"
  957. ElseIf InStr(combo.List(1), po_path) > 0 Then
  958.     found = True
  959.     profile$ = "po1"
  960. ElseIf InStr(combo.List(2), po_path) > 0 Then
  961.     found = True
  962.     profile$ = "po2"
  963. ElseIf InStr(combo.List(3), po_path) > 0 Then
  964.     found = True
  965.     profile$ = "po3"
  966. ElseIf InStr(combo.List(4), po_path) > 0 Then
  967.     found = True
  968.     profile$ = "po4"
  969. ElseIf InStr(combo.List(5), po_path) > 0 Then
  970.     found = True
  971.     profile$ = "po5"
  972. End If
  973.  
  974. If found = True Then
  975.     ret_st$ = String$(256, " ")
  976.     If profile$ = "Default_PO" Then
  977.     x% = GetPrivateProfileString("Default_PO", profile$, "none", ret_st$, Len(ret_st$), INI_FILE)
  978.     Else
  979.     x% = GetPrivateProfileString("prev_po", profile$, "none", ret_st$, Len(ret_st$), INI_FILE)
  980.     End If
  981.     
  982.     start% = InStr(ret_st$, "]")
  983.     If start% <> 0 Then
  984.     'remove po_path part of string
  985.     ret_st$ = Mid$(ret_st$, start% + 1, Len(ret_st$) - start%)
  986.     x% = InStr(ret_st$, "]")
  987.     If x% <> 0 Then
  988.         po_name$ = Mid$(ret_st$, 1, x% - 1)
  989.         po_passwd$ = Mid$(ret_st$, x% + 1, Len(ret_st$) - x%)
  990.     End If
  991.     End If
  992. End If
  993.  
  994.  
  995. End Sub
  996.  
  997. Function get_string (st As String, delim As String, occur As Integer) As String
  998. '8/21/94 - htm
  999. 'returns a string containing the text to the left occurance of delim string
  1000.  
  1001. get_string = ""
  1002. If InStr(st$, delim) = 0 Then Exit Function
  1003.  
  1004. 'example   c:\ccdata]demo]test
  1005.  
  1006. If occur = 1 Then
  1007.     x% = InStr(st$, delim)
  1008.     If x% <> 0 Then 'found it
  1009.     get_string = Mid$(st$, 1, x% - 1)
  1010.     Exit Function
  1011.     End If
  1012. End If
  1013.  
  1014. If occur = 2 Then
  1015.     x% = InStr(st$, delim)
  1016.     If x% <> 0 Then 'found first delim
  1017.     st$ = Mid$(st$, x% + 1, Len(st$) - x%)
  1018.     x% = InStr(st$, delim)
  1019.     If x% <> 0 Then 'found second delim
  1020.         get_string = Mid$(st$, 1, x% - 1)
  1021.         Exit Function
  1022.     End If
  1023.     End If
  1024. End If
  1025.  
  1026. If occur = 3 Then
  1027.     x% = InStr(st$, delim)
  1028.     If x% <> 0 Then 'found first delim
  1029.     st$ = Mid$(st$, x% + 1, Len(st$) - x%)
  1030.     x% = InStr(st$, delim)
  1031.     If x% <> 0 Then 'found second delim
  1032.         get_string = Mid$(st$, x% + 1, Len(st$) - x%)
  1033.         Exit Function
  1034.     End If
  1035.     End If
  1036. End If
  1037.  
  1038. End Function
  1039.  
  1040. Function get_text (st As String) As String
  1041. 'returns the string up to the next space
  1042. 'if no space returns a null string and leaves st alone
  1043.  
  1044. x% = InStr(1, st$, Chr$(32))
  1045. If x% > 0 Then
  1046.     get_text = Mid$(st$, 1, x% - 1)
  1047.     st = Mid$(st$, x% + 1, Len(st$) - x%)
  1048. Else
  1049.     'no spaces therefore return st as get_text
  1050.     get_text = st$
  1051.     st$ = ""
  1052. End If
  1053.  
  1054. End Function
  1055.  
  1056. Sub init_error_array ()
  1057.     ReDim error_array(10)
  1058.     
  1059.     error_array(1).cap_st$ = "Fatal Error"
  1060.     error_array(1).message = "Program not installed correctly" + crlf$ + "Please re-install " + program_name
  1061.     error_array(1).err_type = 16
  1062.  
  1063.     error_array(2).cap_st$ = "Password Problem"
  1064.     error_array(2).message = "Password File not found" + crlf$ + "Please re-install " + program_name
  1065.     error_array(2).err_type = 16
  1066.  
  1067.     error_array(3).cap_st$ = "Fatal Error"
  1068.     error_array(3).message = "Windows ini file is missing" + crlf$ + "Please re-install " + program_name
  1069.     error_array(3).err_type = 16
  1070.     
  1071.     error_array(4).cap_st$ = "Problem with Post Office"
  1072.     error_array(4).message = "Invalid Post Office Path"
  1073.     error_array(4).err_type = 48
  1074.  
  1075.     error_array(5).cap_st$ = "Invalid Date Entered"
  1076.     error_array(5).message = "Check the date format in the /mm/dd/yy box"
  1077.     error_array(5).err_type = 16
  1078.  
  1079.     error_array(6).cap_st$ = "Problem opening output file"
  1080.     error_array(6).message = "Could not open output file"
  1081.     error_array(6).err_type = 16
  1082.  
  1083.     
  1084. End Sub
  1085.  
  1086. Sub init_prev_pos ()
  1087. 'This sub routine makes sure that the keys are present under [prev_po] whether blank or not
  1088.  
  1089.     ret_st$ = String$(256, " ")
  1090.     x% = GetPrivateProfileString("prev_po", "po1", "none", ret_st$, Len(ret_st$), INI_FILE)
  1091.     
  1092.     If Mid$(ret_st$, 1, 1) = Chr$(0) Then   'blank line
  1093.     'po1 not there so add blank key
  1094.     If WritePrivateProfileString("prev_po", "po1", "none", INI_FILE) = 0 Then
  1095.         MsgBox "Unable to write profile string", 48, ini_array(1).appname
  1096.     End If
  1097.     End If
  1098.     ret_st$ = String$(256, " ")
  1099.     x% = GetPrivateProfileString("prev_po", "po2", "none", ret_st$, Len(ret_st$), INI_FILE)
  1100.     
  1101.     If Mid$(ret_st$, 1, 1) = Chr$(0) Then   'blank line
  1102.     'po2 not there so add blank key
  1103.     If WritePrivateProfileString("prev_po", "po2", "none", INI_FILE) = 0 Then
  1104.         MsgBox "Unable to write profile string", 48, ini_array(1).appname
  1105.     End If
  1106.     End If
  1107.     ret_st$ = String$(256, " ")
  1108.     x% = GetPrivateProfileString("prev_po", "po3", "none", ret_st$, Len(ret_st$), INI_FILE)
  1109.     
  1110.     If Mid$(ret_st$, 1, 1) = Chr$(0) Then   'blank line
  1111.     'po3 not there so add blank key
  1112.     If WritePrivateProfileString("prev_po", "po3", "none", INI_FILE) = 0 Then
  1113.         MsgBox "Unable to write profile string", 48, ini_array(1).appname
  1114.     End If
  1115.     End If
  1116.  
  1117.     ret_st$ = String$(256, " ")
  1118.     x% = GetPrivateProfileString("prev_po", "po4", "none", ret_st$, Len(ret_st$), INI_FILE)
  1119.     If Mid$(ret_st$, 1, 1) = Chr$(0) Then   'blank line
  1120.     'po4 not there so add blank key
  1121.     If WritePrivateProfileString("prev_po", "po4", "none", INI_FILE) = 0 Then
  1122.         MsgBox "Unable to write profile string", 48, ini_array(1).appname
  1123.     End If
  1124.     End If
  1125.     
  1126.     ret_st$ = String$(256, " ")
  1127.     x% = GetPrivateProfileString("prev_po", "po5", "none", ret_st$, Len(ret_st$), INI_FILE)
  1128.     If Mid$(ret_st$, 1, 1) = Chr$(0) Then   'blank line
  1129.     'po5 not there so add blank key
  1130.     If WritePrivateProfileString("prev_po", "po5", "none", INI_FILE) = 0 Then
  1131.         MsgBox "Unable to write profile string", 48, ini_array(1).appname
  1132.     End If
  1133.     End If
  1134.  
  1135. End Sub
  1136.  
  1137. Sub insert_commandline (last_line As Integer, position As String)
  1138.     If position = "after" Then
  1139.  
  1140.     'SendKeys "{down}"  'default to Analyze
  1141.     SendKeys "{up}"
  1142.     'cmdline(last_line).Combo1.Text = cmdline(last_line).Combo1.List(0)
  1143.     If last_line > 1 Then
  1144.         mdimain!mnuEditItem(2).Enabled = True
  1145.     End If
  1146.     Load cmdline(last_line)
  1147.     cmdline(last_line).Tag = last_line   'save array position
  1148.     cmdline(last_line).description.Visible = True
  1149.     cmdline(last_line).Label1.Visible = True
  1150.     cmdline(last_line).Combo1.Visible = True
  1151.     'cmdline(last_line).Desc.visible = True   'description
  1152.     cmdline(last_line).Panel3D1.Visible = True  'description
  1153.     cmdline(last_line).Sequence.Visible = True
  1154.     cmdline(last_line).Combo2.Visible = True
  1155.     cmdline(last_line).Move_Button.Visible = True
  1156.     For j = 0 To 4
  1157.         cmdline(last_line).buttons(j).Visible = True
  1158.     Next j
  1159.     mdimain.Arrange CASCADE
  1160.     
  1161.     'dirty = True
  1162.  
  1163.     End If
  1164.     
  1165. End Sub
  1166.  
  1167. '------------------------------------------------------
  1168. ' Function:   IsValidPath as integer
  1169. ' arguments:  DestPath$         a string that is a full path
  1170. '             DefaultDrive$     the default drive.  eg.  "C:"
  1171. '
  1172. '  If DestPath$ does not include a drive specification,
  1173. '  IsValidPath uses Default Drive
  1174. '
  1175. '  When IsValidPath is finished, DestPath$ is reformated
  1176. '  to the format "X:\dir\dir\dir\"
  1177. '
  1178. ' Result:  True (-1) if path is valid.
  1179. '          False (0) if path is invalid
  1180. '-------------------------------------------------------
  1181. Function isvalidpath (destpath$, ByVal DefaultDrive$) As Integer
  1182.  
  1183.     '----------------------------
  1184.     ' Remove left and right spaces
  1185.     '----------------------------
  1186.     destpath$ = RTrim$(LTrim$(destpath$))
  1187.     
  1188.  
  1189.     '-----------------------------
  1190.     ' Check Default Drive Parameter
  1191.     '-----------------------------
  1192.     If Right$(DefaultDrive$, 1) <> ":" Or Len(DefaultDrive$) <> 2 Then
  1193.     MsgBox "Bad default drive parameter specified in IsValidPath Function.  You passed,  """ + DefaultDrive$ + """.  Must be one drive letter and "":"".  For example, ""C:"", ""D:""...", 64, "Setup Kit Error"
  1194.     GoTo parseErr
  1195.     End If
  1196.     
  1197.  
  1198.     '-------------------------------------------------------
  1199.     ' Insert default drive if path begins with root backslash
  1200.     '-------------------------------------------------------
  1201.     If Left$(destpath$, 1) = "\" Then
  1202.     destpath$ = DefaultDrive + destpath$
  1203.     End If
  1204.     
  1205.     '-----------------------------
  1206.     ' check for invalid characters
  1207.     '-----------------------------
  1208.     On Error Resume Next
  1209.     'tmp$ = Dir$(DestPath$)
  1210.     current$ = CurDir$
  1211.     ChDir destpath$
  1212.     If Err <> 0 Then
  1213.     ChDir current$
  1214.     GoTo parseErr
  1215.     End If
  1216.     ChDir current$
  1217.     
  1218.     '-----------------------------------------
  1219.     ' Check for wildcard characters and spaces
  1220.     '-----------------------------------------
  1221.     If (InStr(destpath$, "*") <> 0) GoTo parseErr
  1222.     If (InStr(destpath$, "?") <> 0) GoTo parseErr
  1223.     If (InStr(destpath$, " ") <> 0) GoTo parseErr
  1224.      
  1225.     
  1226.     '------------------------------------------
  1227.     ' Make Sure colon is in second char position
  1228.     '------------------------------------------
  1229.     If Mid$(destpath$, 2, 1) <> Chr$(58) Then GoTo parseErr
  1230.     
  1231.  
  1232.     '-------------------------------
  1233.     ' Insert root backslash if needed
  1234.     '-------------------------------
  1235.     If Len(destpath$) > 2 Then
  1236.       If Right$(Left$(destpath$, 3), 1) <> "\" Then
  1237.     destpath$ = Left$(destpath$, 2) + "\" + Right$(destpath$, Len(destpath$) - 2)
  1238.       End If
  1239.     End If
  1240.  
  1241.     '-------------------------
  1242.     ' Check drive to install on
  1243.     '-------------------------
  1244.     drive$ = Left$(destpath$, 1)
  1245.     ChDrive (drive$)                                                        ' Try to change to the dest drive
  1246.     If Err <> 0 Then GoTo parseErr
  1247.     
  1248.     '-----------
  1249.     ' Add final \
  1250.     '-----------
  1251.     If Right$(destpath$, 1) <> "\" Then
  1252.     destpath$ = destpath$ + "\"
  1253.     End If
  1254.     
  1255.  
  1256.     '-------------------------------------
  1257.     ' Root dir is a valid dir
  1258.     '-------------------------------------
  1259.     If Len(destpath$) = 3 Then
  1260.     If Right$(destpath$, 2) = ":\" Then
  1261.         GoTo ParseOK
  1262.     End If
  1263.     End If
  1264.     
  1265.  
  1266.     '------------------------
  1267.     ' Check for repeated Slash
  1268.     '------------------------
  1269.     If InStr(destpath$, "\\") <> 0 Then GoTo parseErr
  1270.     
  1271.     '--------------------------------------
  1272.     ' Check for illegal directory names
  1273.     '--------------------------------------
  1274.     legalChar$ = "!#$%&'()-0123456789@ABCDEFGHIJKLMNOPQRSTUVWXYZ^_`{}~."
  1275.     BackPos = 3
  1276.     forePos = InStr(4, destpath$, "\")
  1277.     Do
  1278.     temp$ = Mid$(destpath$, BackPos + 1, forePos - BackPos - 1)
  1279.     
  1280.     '----------------------------
  1281.     ' Test for illegal characters
  1282.     '----------------------------
  1283.     For i = 1 To Len(temp$)
  1284.         If InStr(legalChar$, UCase$(Mid$(temp$, i, 1))) = 0 Then GoTo parseErr
  1285.     Next i
  1286.  
  1287.     '-------------------------------------------
  1288.     ' Check combinations of periods and lengths
  1289.     '-------------------------------------------
  1290.     periodPos = InStr(temp$, ".")
  1291.     length = Len(temp$)
  1292.     If periodPos = 0 Then
  1293.         If length > 8 Then GoTo parseErr                         ' Base too long
  1294.     Else
  1295.         If periodPos > 9 Then GoTo parseErr                      ' Base too long
  1296.         If length > periodPos + 3 Then GoTo parseErr             ' Extension too long
  1297.         If InStr(periodPos + 1, temp$, ".") <> 0 Then GoTo parseErr' Two periods not allowed
  1298.     End If
  1299.  
  1300.     BackPos = forePos
  1301.     forePos = InStr(BackPos + 1, destpath$, "\")
  1302.     Loop Until forePos = 0
  1303.  
  1304. ParseOK:
  1305.     isvalidpath = True
  1306.     Exit Function
  1307.  
  1308. parseErr:
  1309.     isvalidpath = False
  1310. End Function
  1311.  
  1312. Function kill_file (fname As String) As Integer
  1313.  
  1314. kill_file = False
  1315. On Error GoTo kill_err
  1316.  
  1317.     Kill fname
  1318.     kill_file = True
  1319.     Exit Function
  1320.  
  1321. kill_err:
  1322.     'MsgBox Str$(Err)
  1323.     kill_file = False
  1324.     Exit Function
  1325.  
  1326.  
  1327. End Function
  1328.  
  1329. Sub makebevel (TheControl As Control)
  1330.     TheControl.DrawWidth = 2
  1331.     TheControl.ScaleMode = 3
  1332.     BoxTop% = 0 + 1
  1333.     BoxBottom% = TheControl.ScaleHeight - 1
  1334.     BoxLeft% = 0 + 1
  1335.     BoxRight% = TheControl.ScaleWidth - 1
  1336.     TheControl.AutoRedraw = True
  1337.     TheControl.Line (BoxLeft%, BoxBottom%)-(BoxRight%, BoxBottom%), QBColor(15), B
  1338.     TheControl.Line (BoxRight%, BoxTop%)-(BoxRight%, BoxBottom%), QBColor(15), B
  1339.     TheControl.Line (BoxLeft%, BoxTop%)-(BoxRight%, BoxTop%), QBColor(8), B
  1340.     TheControl.Line (BoxLeft%, BoxTop%)-(BoxLeft%, BoxBottom%), QBColor(8), B
  1341.     TheControl.AutoRedraw = False
  1342. End Sub
  1343.  
  1344. Sub open_demo_file ()
  1345.         
  1346.         fname$ = ini_array(13).setting + "demo.cmd"
  1347.         
  1348.         recordlen = Len(cmd_rec)
  1349.         filenum = FreeFile
  1350.         If open_random_file(fname$) Then
  1351.             new_file = False
  1352.             mdimain.mnufileitem(2).Enabled = True 'file open
  1353.             mdimain.mnufileitem(3).Enabled = True 'file close
  1354.             mdimain.mnufileitem(4).Enabled = True   'save
  1355.             mdimain.mnufileitem(5).Enabled = True   'save as
  1356.             For i = 0 To 2
  1357.             mdimain!mnuEditItem(i).Enabled = True
  1358.             Next i
  1359.             For i = 0 To 3
  1360.             mdimain.mnuWindowItem(i).Enabled = True
  1361.             Next i
  1362.             Call close_current_file  'closes out child forms
  1363.             last_line = 0
  1364.             mdimain.Caption = program_name + " - [" + fname$ + "]"
  1365.             cmd_file_name$ = fname$
  1366.             
  1367.             rec_num = LOF(filenum) / Len(cmd_rec)
  1368.             For read_recs = 1 To rec_num
  1369.             last_line = last_line + 1
  1370.             Get filenum, last_line, cmd_rec
  1371.             temp1$ = RTrim$(cmd_rec.cap_st$)
  1372.             temp2$ = RTrim$(cmd_rec.command$)
  1373.             temp3$ = RTrim$(cmd_rec.Desc$)
  1374.             Load cmdline(last_line)
  1375.             mdimain.Arrange CASCADE
  1376.             bounce_back = True
  1377.             cmdline(last_line).Caption = temp1$
  1378.             If temp2$ = "Analyze" Then
  1379.                 cmdline(last_line).Combo1.ListIndex = 0
  1380.             ElseIf temp2$ = "Backup" Then
  1381.                 cmdline(last_line).Combo1.ListIndex = 1
  1382.             ElseIf temp2$ = "ChkStat" Then
  1383.                 cmdline(last_line).Combo1.ListIndex = 2
  1384.             Else
  1385.                 cmdline(last_line).Combo1.ListIndex = 3
  1386.             End If
  1387.             bounce_back = False
  1388.             cmdline(last_line).Panel3D1.Caption = temp3$
  1389.             cmdline(last_line).Tag = last_line   'save array position
  1390.             cmdline(last_line).Label1.Visible = True
  1391.             cmdline(last_line).description.Visible = True
  1392.             cmdline(last_line).Combo1.Visible = True
  1393.             cmdline(last_line).Panel3D1.Visible = True   'description
  1394.             cmdline(last_line).Sequence.Visible = True
  1395.             cmdline(last_line).Combo2.Visible = True
  1396.             cmdline(last_line).Move_Button.Visible = True
  1397.             cmdline(last_line).Caption = temp1$
  1398.             cmdline(last_line).Panel3D1.Caption = temp3$
  1399.  
  1400.             st$ = get_outfile2()
  1401.             If file_exists(st$) Then    'turn on buttons
  1402.                 cmdline(last_line).buttons(1).Enabled = True
  1403.                 cmdline(last_line).buttons(4).Enabled = True
  1404.             End If
  1405.             'check to see if run should be on
  1406.             Desc$ = cmdline(current_line).Panel3D1.Caption
  1407.             If InStr(Desc$, "chkstat") <> 0 Then
  1408.                 cmdline(last_line).buttons(1).Enabled = True
  1409.             ElseIf InStr(Desc$, "reclaim") <> 0 Then
  1410.                 cmdline(last_line).buttons(1).Enabled = True
  1411.             ElseIf InStr(Desc$, "analyze") <> 0 Then
  1412.                 cmdline(last_line).buttons(1).Enabled = True
  1413.             ElseIf InStr(Desc$, "copy") <> 0 Then
  1414.                 cmdline(last_line).buttons(1).Enabled = True
  1415.             End If
  1416.             For j = 0 To 4
  1417.                 cmdline(last_line).buttons(j).Visible = True
  1418.             Next j
  1419.             Next read_recs
  1420.             dirty = False
  1421.             
  1422.             Close filenum
  1423.             UpdateMainMenu  'add fname to file menu
  1424.         End If
  1425.  
  1426. End Sub
  1427.  
  1428. Function open_existing_file () As Integer
  1429.         open_existing_file = False
  1430.         Load frmopenfile
  1431.         Unload frmopenfile
  1432.         Load frmopenfile
  1433.         frmopenfile.Caption = "Open File"
  1434.         frmopenfile.file_desc.Enabled = False
  1435.         frmopenfile.Show 1
  1436.         If frmopenfile.Text1.Text <> "" Then
  1437.         fname$ = frmopenfile.Text1.Text
  1438.         'Stop
  1439.         If Mid$(fname$, 2, 1) <> ":" Then   'no path entered
  1440.             If Mid$(frmopenfile.Dir1.Path, Len(frmopenfile.Dir1.Path), 1) = "\" Then
  1441.             fname$ = frmopenfile.Dir1.Path + frmopenfile.Text1.Text
  1442.             Else
  1443.             fname$ = frmopenfile.Dir1.Path + "\" + frmopenfile.Text1.Text
  1444.             End If
  1445.         End If
  1446.             
  1447.         If Not file_exists(fname$) Then
  1448.             st$ = UCase(fname$) + crlf$ + crlf$ + "This filename is not valid"
  1449.             rr% = MsgBox(st$, 48, "File Open")
  1450.             If rr% = 7 Then Exit Function
  1451.         End If
  1452.         
  1453.         recordlen = Len(cmd_rec)
  1454.         filenum = FreeFile
  1455.         If open_random_file(fname$) Then
  1456.             new_file = False
  1457.             mdimain.mnufileitem(2).Enabled = True 'file open
  1458.             mdimain.mnufileitem(3).Enabled = True 'file close
  1459.             mdimain.mnufileitem(4).Enabled = True   'save
  1460.             mdimain.mnufileitem(5).Enabled = True   'save as
  1461.             For i = 0 To 2
  1462.             mdimain!mnuEditItem(i).Enabled = True
  1463.             Next i
  1464.             For i = 0 To 3
  1465.             mdimain.mnuWindowItem(i).Enabled = True
  1466.             Next i
  1467.             Call close_current_file  'closes out child forms
  1468.             last_line = 0
  1469.             mdimain.Caption = program_name + " - [" + fname$ + "]"
  1470.             cmd_file_name$ = fname$
  1471.             
  1472.             rec_num = LOF(filenum) / Len(cmd_rec)
  1473.             For read_recs = 1 To rec_num
  1474.             last_line = last_line + 1
  1475.             Get filenum, last_line, cmd_rec
  1476.             temp1$ = RTrim$(cmd_rec.cap_st$)
  1477.             temp2$ = RTrim$(cmd_rec.command$)
  1478.             temp3$ = RTrim$(cmd_rec.Desc$)
  1479.             Load cmdline(last_line)
  1480.             mdimain.Arrange CASCADE
  1481.             bounce_back = True
  1482.             cmdline(last_line).Caption = temp1$
  1483.             If temp2$ = "Analyze" Then
  1484.                 cmdline(last_line).Combo1.ListIndex = 0
  1485.             ElseIf temp2$ = "Backup" Then
  1486.                 cmdline(last_line).Combo1.ListIndex = 1
  1487.             ElseIf temp2$ = "ChkStat" Then
  1488.                 cmdline(last_line).Combo1.ListIndex = 2
  1489.             Else
  1490.                 cmdline(last_line).Combo1.ListIndex = 3
  1491.             End If
  1492.             bounce_back = False
  1493.             cmdline(last_line).Panel3D1.Caption = temp3$
  1494.             cmdline(last_line).Tag = last_line   'save array position
  1495.             cmdline(last_line).description.Visible = True
  1496.             cmdline(last_line).Label1.Visible = True
  1497.             cmdline(last_line).Combo1.Visible = True
  1498.             cmdline(last_line).Panel3D1.Visible = True   'description
  1499.             cmdline(last_line).Sequence.Visible = True
  1500.             cmdline(last_line).Combo2.Visible = True
  1501.             cmdline(last_line).Move_Button.Visible = True
  1502.             cmdline(last_line).Caption = temp1$
  1503.             cmdline(last_line).Panel3D1.Caption = temp3$
  1504.  
  1505.             st$ = get_outfile2()
  1506.             If file_exists(st$) Then    'turn on buttons
  1507.                 cmdline(last_line).buttons(1).Enabled = True
  1508.                 cmdline(last_line).buttons(4).Enabled = True
  1509.             End If
  1510.             'check to see if run should be on
  1511.             Desc$ = cmdline(current_line).Panel3D1.Caption
  1512.             If InStr(Desc$, "chkstat") <> 0 Then
  1513.                 cmdline(last_line).buttons(1).Enabled = True
  1514.             ElseIf InStr(Desc$, "reclaim") <> 0 Then
  1515.                 cmdline(last_line).buttons(1).Enabled = True
  1516.             ElseIf InStr(Desc$, "analyze") <> 0 Then
  1517.                 cmdline(last_line).buttons(1).Enabled = True
  1518.             ElseIf InStr(Desc$, "copy") <> 0 Then
  1519.                 cmdline(last_line).buttons(1).Enabled = True
  1520.             End If
  1521.             For j = 0 To 4
  1522.                 cmdline(last_line).buttons(j).Visible = True
  1523.             Next j
  1524.             
  1525.             Next read_recs
  1526.             dirty = False
  1527.             open_existing_file = True
  1528.             Close filenum
  1529.             UpdateMainMenu  'add fname to file menu
  1530.         End If
  1531.         End If
  1532.  
  1533. End Function
  1534.  
  1535. Function open_for_input (fname As String) As Integer
  1536. 'opens a file for input
  1537.  
  1538. open_for_input = 0
  1539.  
  1540. On Error GoTo err_input
  1541.     filenum = FreeFile
  1542.     Open fname For Input As filenum
  1543.     open_for_input = filenum
  1544.     Exit Function
  1545.  
  1546. err_input:
  1547.     Exit Function
  1548.  
  1549. End Function
  1550.  
  1551. Function open_for_output (fname As String) As Integer
  1552. 'opens a file for output
  1553.  
  1554. open_for_output = 0
  1555.  
  1556. On Error GoTo err_open
  1557.     filenum = FreeFile
  1558.     Open fname For Output As filenum
  1559.     open_for_output = filenum
  1560.     Exit Function
  1561.  
  1562. err_open:
  1563.     Exit Function
  1564. End Function
  1565.  
  1566. Function open_random_file (fname As String) As Integer
  1567.  
  1568. open_random_file = False
  1569. On Error GoTo open_error
  1570.  
  1571. Open fname$ For Random As filenum Len = recordlen
  1572.  
  1573. recordlen = Len(cmd_rec)
  1574.  
  1575. open_random_file = True
  1576. Exit Function
  1577.  
  1578. open_error:
  1579. st$ = "Unable to Create File: " + fname$
  1580. rr% = MsgBox(st$, 16, "File Error")
  1581.  
  1582. Exit Function
  1583.  
  1584.  
  1585. End Function
  1586.  
  1587. Sub pack_it ()
  1588.  
  1589.         rr% = MsgBox("This will remove any reports attached to your cc:Mail commands.", 17, "Pack File")
  1590.         If rr% = 2 Then
  1591.             Exit Sub
  1592.         End If
  1593.         
  1594.         the_file$ = fname$
  1595.         recordlen = Len(cmd_rec)
  1596.         If Not kill_file(the_file$) Then
  1597.         End If
  1598.         
  1599.         filenum% = FreeFile
  1600.         j = 1
  1601.         If open_random_file(the_file$) Then
  1602.             For i = 1 To last_line
  1603.             'delete report files if there...
  1604.             rname$ = Mid$(the_file$, 1, Len(the_file$) - 4)
  1605.             old_tag$ = String$(3 - Len(LTrim$(Str$(i))), "0") + Trim$(Str$(i))
  1606.             If Not kill_file(rname$ + "." + old_tag$) Then
  1607.             End If
  1608.             
  1609.             If InStr(cmdline(i).Caption, "Excluded") = 0 Then
  1610.                 ss$ = Mid$(cmdline(i).Caption, 4, Len(cmdline(i).Caption) - 3)
  1611.                 tag_st$ = Str$(j)
  1612.                 tag_st$ = LTrim$(tag_st$)
  1613.                 tag_st$ = String$(3 - Len(tag_st$), "0") + tag_st$
  1614.                 cmd_rec.cap_st$ = tag_st$ + ss$
  1615.                 
  1616.                 cmd_rec.command$ = cmdline(i).Combo1.Text
  1617.                 cmd_rec.Desc = cmdline(i).Panel3D1.Caption
  1618.                 Put #filenum%, j, cmd_rec
  1619.                 j = j + 1
  1620.             Else
  1621.                 dirty = True
  1622.             End If
  1623.             Next i
  1624.             dirty = False
  1625.             Close filenum%
  1626.         End If
  1627.         
  1628.         recordlen = Len(cmd_rec)
  1629.         filenum = FreeFile
  1630.         If open_random_file(the_file$) Then
  1631.             Call close_current_file  'closes out child forms
  1632.             last_line = 0
  1633.             
  1634.             rec_num = LOF(filenum) / Len(cmd_rec)
  1635.             For read_recs = 1 To rec_num
  1636.             last_line = last_line + 1
  1637.             Get filenum, last_line, cmd_rec
  1638.             temp1$ = RTrim$(cmd_rec.cap_st$)
  1639.             temp2$ = RTrim$(cmd_rec.command$)
  1640.             temp3$ = RTrim$(cmd_rec.Desc$)
  1641.             
  1642.             Load cmdline(last_line)
  1643.             mdimain.Arrange CASCADE
  1644.  
  1645.             bounce_back = True
  1646.             cmdline(last_line).Caption = temp1$
  1647.             If temp2$ = "Analyze" Then
  1648.                 cmdline(last_line).Combo1.ListIndex = 0
  1649.             ElseIf temp2$ = "Backup" Then
  1650.                 cmdline(last_line).Combo1.ListIndex = 1
  1651.             ElseIf temp2$ = "ChkStat" Then
  1652.                 cmdline(last_line).Combo1.ListIndex = 2
  1653.             Else
  1654.                 cmdline(last_line).Combo1.ListIndex = 3
  1655.             End If
  1656.             bounce_back = False
  1657.  
  1658.             cmdline(last_line).Panel3D1.Caption = temp3$
  1659.             cmdline(last_line).Tag = last_line   'save array position
  1660.             cmdline(last_line).description.Visible = True
  1661.             cmdline(last_line).Combo1.Visible = True
  1662.             cmdline(last_line).Panel3D1.Visible = True   'description
  1663.             cmdline(last_line).Sequence.Visible = True
  1664.             cmdline(last_line).Combo2.Visible = True
  1665.             cmdline(last_line).Move_Button.Visible = True
  1666.             For j = 0 To 4
  1667.                 cmdline(last_line).buttons(j).Visible = True
  1668.             Next j
  1669.             cmdline(last_line).Caption = temp1$
  1670.             cmdline(last_line).Panel3D1.Caption = temp3$
  1671.             
  1672.             st$ = get_outfile2()
  1673.             If file_exists(st$) Then    'turn on buttons
  1674.                 cmdline(last_line).buttons(1).Enabled = True
  1675.                 cmdline(last_line).buttons(4).Enabled = True
  1676.             End If
  1677.             
  1678.             Next read_recs
  1679.             Close filenum
  1680.         End If
  1681.         
  1682.  
  1683.  
  1684. End Sub
  1685.  
  1686. Function pad_it (st As String) As String
  1687. If st = "" Then
  1688.     pad_it = ""
  1689.     Exit Function
  1690. End If
  1691. pad_it = String$(3 - Len(st), "0") + st
  1692. End Function
  1693.  
  1694. Function parse_anal5 (st As String) As Integer
  1695. parse_anal5 = False
  1696. If st$ = "" Then Exit Function
  1697.  
  1698. If InStr(1, st$, "/users") > 0 Then
  1699.     anal5.Check5.Value = 1
  1700. End If
  1701.  
  1702. If InStr(1, st$, "/batch") > 0 Then
  1703.     anal5.Check1.Value = 1
  1704. End If
  1705.  
  1706. If InStr(1, st$, "/diagnostics") > 0 Then
  1707.     anal5.Check2.Value = 1
  1708. End If
  1709.  
  1710. If InStr(1, st$, "/directory") > 0 Then
  1711.     anal5.Check3.Value = 1
  1712. End If
  1713.  
  1714. If InStr(1, st$, "/messages") > 0 Then
  1715.     anal5.Check4.Value = 1
  1716. End If
  1717.  
  1718. If InStr(1, st$, "/d") > 0 Then     'po path
  1719.     done% = False
  1720.     path_start = InStr(1, st$, "/d") + 2    'first letter in path part
  1721.     i = 0
  1722.     While Not done%
  1723.     ch$ = Mid$(st$, path_start + i, 1)
  1724.     If path_start + i = Len(st$) Then   'they only entered a po path
  1725.         done% = True
  1726.     ElseIf ch$ = " " Then
  1727.         done% = True
  1728.         i = i - 1
  1729.     Else
  1730.         i = i + 1
  1731.     End If
  1732.     Wend
  1733.     po_path$ = Mid$(st$, path_start, ((path_start + i) - path_start) + 1)
  1734.     Call check_combo1_list(anal5, po_path$, "", "")'check if po_path in list and add to combo box and prev_po list if necessary
  1735.  
  1736.  
  1737. End If
  1738.  
  1739. If InStr(1, st$, "/usr") > 0 Then
  1740.     done% = False
  1741.     usr_start = InStr(1, st$, "/usr") + 5
  1742.     i = 0
  1743.     While Not done%
  1744.     ch$ = Mid$(st$, usr_start + i, 1)
  1745.     If usr_start + i = Len(st$) Then
  1746.         done% = True
  1747.     ElseIf ch$ = " " Then
  1748.         done% = True
  1749.         i = i - 1
  1750.     Else
  1751.         i = i + 1
  1752.     End If
  1753.     Wend
  1754.     usr$ = "usr" + Mid$(st$, usr_start, ((usr_start + i) - usr_start) + 1)
  1755.     For i = 0 To anal5.List1.ListCount - 1
  1756.     If anal5.List1.List(i) = usr$ Then
  1757.         anal5.List1.Selected(i) = True
  1758.     End If
  1759.     Next i
  1760. End If
  1761.  
  1762. If InStr(1, st$, "/n") > 0 Then
  1763.     done% = False
  1764.     usr_start = InStr(1, st$, "/n") + 3
  1765.     i = 0
  1766.     While Not done%
  1767.     ch$ = Mid$(st$, usr_start + i, 1)
  1768.     If usr_start + i = Len(st$) Then
  1769.         done% = True
  1770.     ElseIf ch$ = Chr$(34) Then
  1771.         done% = True
  1772.         i = i - 1
  1773.     Else
  1774.         i = i + 1
  1775.     End If
  1776.     Wend
  1777.     anal5.Text4.Text = Mid$(st$, usr_start, ((usr_start + i) - usr_start) + 1)
  1778. End If
  1779.  
  1780. End Function
  1781.  
  1782. Function parse_backup (st As String) As Integer
  1783.  
  1784. s = False
  1785. d = False
  1786.  
  1787. On Error GoTo parse_error
  1788.     parse_backup = False
  1789.     If InStr(1, st$, "for") > 0 Then 'usr files
  1790.     If InStr(1, st$, "[Enter]") = 0 Then
  1791.         ccbackup.chkfile1.Value = True
  1792.     End If
  1793.     End If
  1794.     If InStr(1, st$, "mlandata") > 0 Then 'mlandata
  1795.     ccbackup.chkfile2.Value = True
  1796.     End If
  1797.     If InStr(1, st$, "clandata") > 0 Then   'clandata
  1798.     ccbackup.chkfile0.Value = True
  1799.     End If
  1800.  
  1801.     x% = ccbackup.chkfile0.Value + ccbackup.chkfile1.Value + ccbackup.chkfile2.Value
  1802.     If x% = -3 Then
  1803.     ccbackup.chkfile3.Value = True
  1804.     End If
  1805.  
  1806.     'now get source and destination paths
  1807.     If InStr(1, st$, "mlandata") > 0 Then
  1808.     temp$ = ""
  1809.     ch$ = ""
  1810.     i = 1
  1811.     Do
  1812.         temp$ = temp$ + ch$
  1813.         ch$ = Mid$(st$, i + 5, 1)
  1814.         i = i + 1
  1815.     Loop Until ch$ = Chr$(32)
  1816.     
  1817.     st2$ = Mid$(st$, i + 5, Len(st$) - i + 1)   'for finding destination
  1818.     x% = InStr(1, st2$, Chr$(13))
  1819.     If x% = 0 Then
  1820.         temp2$ = st2$
  1821.     Else
  1822.         end_pos% = x% - 1
  1823.         temp2$ = Mid$(st2$, 1, end_pos%)
  1824.     End If
  1825.  
  1826.     x% = InStr(temp2$, ">>")
  1827.     If x% > 0 Then
  1828.         temp2$ = Mid$(temp2$, 1, x% - 2)
  1829.     End If
  1830.     
  1831.     d = True
  1832.     ccbackup.Dir2.Path = temp2$     'destination
  1833.     d = False
  1834.     x% = InStr(1, temp$, "mlandata")
  1835.     temp$ = Mid$(temp$, 1, x% - 1)
  1836.     s = True
  1837.     ccbackup.Dir1.Path = temp$
  1838.     s = False
  1839.     ElseIf InStr(1, st$, "clandata") > 0 Then
  1840.     temp$ = ""
  1841.     ch$ = ""
  1842.     i = 1
  1843.     Do
  1844.         temp$ = temp$ + ch$
  1845.         ch$ = Mid$(st$, i + 5, 1)
  1846.         i = i + 1
  1847.     Loop Until ch$ = Chr$(32)
  1848.     st2$ = Mid$(st$, i + 5, Len(st$) - i + 1)   'for finding destination
  1849.     x% = InStr(1, st2$, Chr$(13))
  1850.     If x% = 0 Then
  1851.         temp2$ = st2$
  1852.     Else
  1853.         end_pos% = x% - 1
  1854.         temp2$ = Mid$(st2$, 1, end_pos%)
  1855.     End If
  1856.     
  1857.     x% = InStr(temp2$, ">>")
  1858.     If x% > 0 Then
  1859.         temp2$ = Mid$(temp2$, 1, x% - 2)
  1860.     End If
  1861.  
  1862.     d = True
  1863.     ccbackup.Dir2.Path = temp2$     'destination
  1864.     d = False
  1865.     x% = InStr(1, temp$, "clandata")
  1866.     temp$ = Mid$(temp$, 1, x% - 1)
  1867.     s = True
  1868.     ccbackup.Dir1.Path = temp$
  1869.     s = False
  1870.     ElseIf InStr(1, st$, "for") > 0 Then
  1871.     start_pos% = 13
  1872.     end_pos% = InStr(1, st$, "usr") - 1
  1873.     temp$ = Mid$(st$, start_pos%, end_pos% - start_pos% + 1)
  1874.     s = True
  1875.     ccbackup.Dir1.Path = temp$
  1876.     s = False
  1877.     start_pos% = InStr(1, st$, "copy %%") + 9
  1878.     end_pos% = InStr(1, st$, "usr????? >") - 1
  1879.     temp2$ = Mid$(st$, start_pos%, end_pos% - start_pos% + 1)
  1880.     d = True
  1881.     ccbackup.Dir2.Path = temp2$
  1882.     d = False
  1883.     End If
  1884.  
  1885.    
  1886. Exit Function
  1887.  
  1888. parse_error:
  1889. If s = True Then
  1890.     'ccbackup.source.Text = ""
  1891.     last_ch$ = Mid$(temp$, Len(temp$), 1)
  1892.     If last_ch$ = "\" Then
  1893.     ccbackup.source.Text = Mid$(temp$, 1, Len(temp$) - 1)
  1894.     Else
  1895.     ccbackup.source.Text = temp$
  1896.     End If
  1897.  
  1898. End If
  1899. If d = True Then
  1900.     'ccbackup.destination.Text = ""
  1901.     last_ch$ = Mid$(temp2$, Len(temp2$), 1)
  1902.     If last_ch$ = "\" Then
  1903.     ccbackup.destination.Text = Mid$(temp2$, 1, Len(temp2$) - 1)
  1904.     Else
  1905.     ccbackup.destination.Text = temp2$
  1906.     End If
  1907. End If
  1908. Resume Next
  1909.  
  1910.     
  1911. End Function
  1912.  
  1913. Function parse_filename (ByVal st As String) As String
  1914.  
  1915. parse_filename = Mid$(st$, 1, Len(st$) - 4)
  1916. Exit Function
  1917.  
  1918.  
  1919.  
  1920. done = False
  1921. i = Len(st$) - 4    'start at character before dot
  1922. new_st$ = ""
  1923. While Not done
  1924.     ch$ = Mid$(st$, i, 1)
  1925.     If ch$ = ":" Or ch$ = "\" Or ch$ = "/" Then
  1926.     done = True
  1927.     ElseIf i = 1 Then   'at beginning of string
  1928.     done = True
  1929.     new_st$ = new_st$ + ch$
  1930.     Else
  1931.     new_st$ = new_st$ + ch$
  1932.     End If
  1933.     i = i - 1
  1934. Wend
  1935.  
  1936. temp$ = ""  'reverse it
  1937. For i = 1 To Len(new_st$)
  1938.     ch$ = Mid$(new_st$, i, 1)
  1939.     temp$ = ch$ + temp$
  1940. Next i
  1941.  
  1942. parse_filename = temp$
  1943.  
  1944. End Function
  1945.  
  1946. Function parse_newchk (st As String) As Integer
  1947. parse_newchk = False
  1948. 'first get the poname, pass, and path
  1949.  
  1950. 'remove any leading blanks
  1951. done = False
  1952. While Not done
  1953.     ch$ = Mid$(st$, 1, 1)
  1954.     If ch$ = " " Then
  1955.     st$ = Mid$(st$, 2, Len(st$) - 1)
  1956.     Else
  1957.     done = True
  1958.     End If
  1959. Wend
  1960. 'remove and trailing blanks
  1961. done = False
  1962. While Not done
  1963.     ch$ = Mid$(st$, Len(st$), 1)
  1964.     If ch$ = " " Then
  1965.     st$ = Mid$(st$, 1, Len(st$) - 1)
  1966.     Else
  1967.     done = True
  1968.     End If
  1969. Wend
  1970.  
  1971. x% = InStr(1, st$, "chkstat")
  1972. If x% = 0 Then Exit Function
  1973. 'take off chkstat.exe
  1974. st$ = Mid$(st$, x% + 8, Len(st$) - (x% - 7))
  1975.  
  1976. done = False
  1977. i = 0
  1978. While Not done
  1979.     temp$ = get_text(st$)
  1980.     
  1981.     ch$ = Mid$(temp$, 2, 1)
  1982.  
  1983.     If ch$ = "n" Then
  1984.     newchk!poname.Text = Mid$(temp$, 3, Len(temp$) - 2)
  1985.     ElseIf ch$ = "d" Then
  1986.     
  1987.     popath = Mid$(temp$, 3, Len(temp$) - 2)
  1988.     found = False
  1989.     marker = 0
  1990.     For xx = 0 To (newchk!combo1.ListCount - 1)
  1991.         If LCase$(newchk!combo1.List(xx)) = LCase$(popath) Then
  1992.         found = True
  1993.         marker = xx 'place found
  1994.         End If
  1995.     Next xx
  1996.  
  1997.     If found Then
  1998.         newchk!combo1.ListIndex = marker
  1999.     Else
  2000.         newchk!combo1.AddItem popath
  2001.         newchk!combo1.ListIndex = newchk!combo1.ListCount - 1 'set combo1 to display this path
  2002.     End If
  2003.     
  2004.     ElseIf ch$ = "p" Then
  2005.     newchk!popassword.Text = Mid$(temp$, 3, Len(temp$) - 2)
  2006.     Else
  2007.     Exit Function
  2008.     End If
  2009.     i = i + 1
  2010.     If i = 3 Then done = True
  2011. Wend
  2012. parse_newchk = True
  2013.  
  2014. End Function
  2015.  
  2016. Function parse_reclaim (st As String) As Integer
  2017.     done = False
  2018.     Do
  2019.     temp$ = get_text(st)
  2020.     'now check for ccmail options
  2021.     If InStr(1, temp$, "/n") > 0 Then
  2022.         frm_reclaim.Text1.Text = Mid$(temp$, 3, Len(temp$) - 2)
  2023.     ElseIf InStr(1, temp$, "/p") > 0 Then
  2024.         frm_reclaim.Text2.Text = Mid(temp$, 3, Len(temp$) - 2)
  2025.     ElseIf InStr(1, temp$, "/d") > 0 Then
  2026.         'frm_reclaim.Text3.Text = Mid(temp$, 3, Len(temp$) - 2)
  2027.         frm_reclaim.Combo1.List(0) = Mid(temp$, 3, Len(temp$) - 2)
  2028.     ElseIf temp$ = "/Rename" Then
  2029.         frm_reclaim.Check7.Value = 1
  2030.     ElseIf InStr(1, temp$, "/Directory") > 0 Then
  2031.         'parse /Directory command
  2032.         frm_reclaim.Check1.Value = 1
  2033.         If Len(temp$) > 10 Then 'option on end
  2034.         frm_reclaim.Check2.Value = 1
  2035.         frm_reclaim.Text7.Text = Mid$(temp$, 12, (Len(temp$) - 12) + 1)
  2036.         End If
  2037.     ElseIf InStr(1, temp$, "/NFT/O") > 0 Then
  2038.         frm_reclaim.Check6.Value = 1
  2039.     ElseIf temp$ = "/Messages" Then
  2040.         frm_reclaim.Check5.Value = 1
  2041.     ElseIf InStr(1, temp$, "/Diagnostics") > 0 Then
  2042.         'parse /Diagnostics option
  2043.         frm_reclaim.Check3.Value = 1
  2044.         If Len(temp$) > 12 Then 'option on end
  2045.         frm_reclaim.Check9.Value = 1    'only option available
  2046.         End If
  2047.     ElseIf InStr(1, temp$, "/Ekey") > 0 Then
  2048.         frm_reclaim.Check4.Value = 1
  2049.         If Len(temp$) > 5 Then  'get option
  2050.         frm_reclaim.Text4.Text = Mid$(temp$, 7, (Len(temp$) - 7) + 1)
  2051.         End If
  2052.     ElseIf InStr(1, temp$, "/Target") > 0 Then
  2053.         frm_reclaim.Check8.Value = 1
  2054.         If Len(temp$) > 7 Then
  2055.         frm_reclaim.Text5.Text = Mid$(temp$, 9, (Len(temp$) - 9) + 1)
  2056.         End If
  2057.     End If
  2058.     If st$ = "" Then    'get_text finished with last call to it
  2059.         done = True
  2060.     End If
  2061.     Loop Until done
  2062.  
  2063. End Function
  2064.  
  2065. Function path_exists (st As String) As Integer
  2066.  
  2067.     path_exists = False
  2068.     cur_dir$ = CurDir$
  2069.     If st$ = "" Then Exit Function
  2070.     If Mid$(st$, Len(st$), 1) = ":" Then st$ = st$ + "\"
  2071.     If Mid$(st$, Len(st$), 1) = "\" Then
  2072.     If Mid$(st$, Len(st$) - 1, 1) <> ":" Then
  2073.         st$ = Mid$(st$, 1, Len(st$) - 1)
  2074.     End If
  2075.     End If
  2076.  
  2077. On Error GoTo path_error
  2078.     ChDir st
  2079.     ChDir cur_dir$
  2080.     path_exists = True
  2081.     Exit Function
  2082.  
  2083. path_error:
  2084.     ChDir cur_dir$  'put current directory back
  2085.     Exit Function
  2086.  
  2087. End Function
  2088.  
  2089. Sub post_message (message As String)
  2090.     l = 75
  2091.     mdimain.Picture1.DrawWidth = 15
  2092.     mdimain.Picture1.Line (l, 130)-(l + 2500, 130), QBColor(7)
  2093.     mdimain.Picture1.DrawWidth = 2
  2094.     mdimain.Picture1.CurrentX = 75
  2095.     mdimain.Picture1.CurrentY = 52
  2096.     mdimain.Picture1.Print message
  2097. End Sub
  2098.  
  2099. Function remove_blanks (st As String) As String
  2100.  
  2101. done = False
  2102. remove_blanks = ""
  2103.  
  2104. While Not done
  2105.     ch$ = Mid$(st$, Len(st$), 1)
  2106.     If ch$ = " " Then
  2107.     st$ = Mid$(st$, 1, Len(st$) - 1)
  2108.     Else
  2109.     remove_blanks = st$
  2110.     Exit Function
  2111.     End If
  2112.     If Len(st$) = 1 Then
  2113.     remove_blanks = String$(25, "X")
  2114.     Exit Function
  2115.     End If
  2116. Wend
  2117.  
  2118. End Function
  2119.  
  2120. Sub rename (st1 As String, st2 As String)
  2121. 'Stop
  2122. On Error GoTo ren_err
  2123.     Name st1$ As st2
  2124.     Exit Sub
  2125.  
  2126. ren_err:
  2127.     Exit Sub
  2128.  
  2129.  
  2130. End Sub
  2131.  
  2132. Function replace_blanks (ByVal st As String) As String
  2133.  
  2134. new_st$ = ""
  2135. For i = 1 To Len(st$)
  2136.     char$ = Mid$(st$, i, 1)
  2137.     If char$ = Chr$(32) Then
  2138.     new_st$ = new_st$ + Chr$(160)
  2139.     Else
  2140.     new_st$ = new_st$ + char$
  2141.     End If
  2142. Next i
  2143.  
  2144. replace_blanks = new_st$
  2145.  
  2146. End Function
  2147.  
  2148. Sub save_untitled ()
  2149. 'automatically save as untitled.cmd
  2150.  
  2151. screen_width% = 53
  2152. l_st$ = "001"
  2153. m_st$ = "Analyze"
  2154. r_st$ = ""
  2155.  
  2156. If screen_width% Mod 2 = 0 Then
  2157.     'even length
  2158.     screen_width% = screen_width% - 1
  2159. End If
  2160. ReDim cap_array(screen_width%)
  2161. For i = 1 To screen_width%    'load the array with blanks
  2162.     cap_array(i) = Chr$(160)
  2163. Next i
  2164. 'put left part in array
  2165.  
  2166. For i = 1 To Len(l_st$)
  2167.     cap_array(i) = Mid$(l_st$, i, 1)
  2168. Next i
  2169. 'put middle in array
  2170. If Len(m_st$) Mod 2 = 0 Then
  2171.     is_even = True
  2172. Else
  2173.     is_even = False
  2174. End If
  2175. If is_even Then
  2176.     start_pos% = (Int(screen_width% / 2) - Int(Len(m_st$) / 2)) + 1
  2177. Else
  2178.     start_pos% = Int(screen_width% / 2) - Int(Len(m_st$) / 2)
  2179. End If
  2180. For i = 1 To Len(m_st$)
  2181.     cap_array(start_pos%) = Mid$(m_st$, i, 1)
  2182.     start_pos% = start_pos% + 1
  2183. Next i
  2184. 'put right part in array
  2185. start_pos% = (screen_width% - Len(r_st$)) + 1
  2186. For i = 1 To Len(r_st$)
  2187.     cap_array(start_pos%) = Mid$(r_st$, i, 1)
  2188.     start_pos% = start_pos% + 1
  2189. Next i
  2190. 'build caption string
  2191. cap_st$ = ""
  2192. For i = 1 To screen_width%
  2193.     cap_st$ = cap_st$ + cap_array(i)
  2194. Next i
  2195. cap_st$ = replace_blanks(cap_st$)
  2196.  
  2197. fname$ = ini_array(13).setting + "Untitled.cmd"
  2198. recordlen = Len(cmd_rec)
  2199. If Not kill_file(fname$) Then
  2200. End If
  2201.  
  2202.  
  2203.  
  2204. filenum% = FreeFile
  2205. If open_random_file(fname$) Then
  2206.     cmd_rec.file_desc$ = "No Description"
  2207.     cmd_rec.cap_st$ = cap_st$
  2208.     cmd_rec.command$ = "Analyze"
  2209.     'cmd_rec.desc = "Run Analyze"
  2210.     st$ = "Run Analyze a 'Super ChkStat'" + crlf$ + crlf$
  2211.     st$ = st$ + "The output of this program is can be" + crlf$
  2212.     st$ = st$ + "useful to cc:Mail" + R$ + " Support if you are experiencing Post Office errors."
  2213.     cmd_rec.Desc = st$
  2214.     Put #filenum%, 1, cmd_rec
  2215.     Close filenum%
  2216. End If
  2217.  
  2218.  
  2219.  
  2220.  
  2221. End Sub
  2222.  
  2223. Sub saveas ()
  2224.         del_file$ = fname$
  2225.         old_filename$ = parse_filename(fname$)
  2226.         dirty = False
  2227.         
  2228.         Unload frmopenfile
  2229.         Load frmopenfile
  2230.         
  2231.         frmopenfile.Caption = "Save As"
  2232.         frmopenfile.cmdOpen.Caption = "OK"
  2233.         frmopenfile.file_desc.Enabled = True
  2234.         
  2235.         frmopenfile.Show 1
  2236.         
  2237.         If frmopenfile.Text1.Text <> "" Then
  2238.         fname$ = frmopenfile.Text1.Text
  2239.         file_description$ = frmopenfile.file_desc.Text
  2240.  
  2241.         If Mid$(fname$, 2, 1) <> ":" Then   'no path entered
  2242.             If Mid$(frmopenfile.Dir1.Path, Len(frmopenfile.Dir1.Path), 1) = "\" Then
  2243.             fname$ = frmopenfile.Dir1.Path + frmopenfile.Text1.Text
  2244.             Else
  2245.             fname$ = frmopenfile.Dir1.Path + "\" + frmopenfile.Text1.Text
  2246.             End If
  2247.         End If
  2248.         new_fname$ = parse_filename(fname$)
  2249.         
  2250.         If file_exists(fname$) Then
  2251.             st$ = UCase(fname$) + crlf$ + crlf$ + "Replace existing file?"
  2252.             rr% = MsgBox(st$, 308, "Save File As")
  2253.             If rr% = 7 Then Exit Sub
  2254.         End If
  2255.         
  2256.         recordlen = Len(cmd_rec)
  2257.         If Not kill_file(fname$) Then
  2258.             'just means it was not there
  2259.         End If
  2260.         filenum% = FreeFile
  2261.         
  2262.         If open_random_file(fname$) Then
  2263.             For i = 1 To last_line
  2264.             cmd_rec.file_desc$ = file_description$
  2265.             cmd_rec.cap_st$ = cmdline(i).Caption
  2266.             cmd_rec.command$ = cmdline(i).Combo1.Text
  2267.             cmd_rec.Desc = cmdline(i).Panel3D1.Caption
  2268.             Put #filenum%, i, cmd_rec
  2269.             pad$ = LTrim$(Str$(i))
  2270.             pad$ = String$(3 - Len(pad$), "0")
  2271.             tag_st$ = "." + pad$ + LTrim$(Str$(i))
  2272.             'Call rename(old_filename$ + tag_st$, new_fname$ + tag_st$)
  2273.             Call copy_my_file(old_filename$ + tag_st$, new_fname$ + tag_st$)
  2274.             
  2275.             mdimain.Caption = fname$
  2276.             Next i
  2277.             Close filenum%
  2278.  
  2279.         End If
  2280.  
  2281.         End If
  2282.         Unload frmopenfile
  2283. End Sub
  2284.  
  2285. Sub show_ascii (ByVal st As String)
  2286. new_st = ""
  2287. For i = 1 To Len(st)
  2288.     ch = Mid$(st, i, 1)
  2289.     ch = Str$(Asc(ch))
  2290.     If Len(ch) = 1 Then
  2291.     ch = "0" + ch
  2292.     End If
  2293.     new_st = new_st + ch
  2294. Next i
  2295. MsgBox new_st
  2296. End Sub
  2297.  
  2298. Sub show_error (pos As Integer)
  2299.     'pos is the message to show in error_array
  2300.  
  2301.     MsgBox error_array(pos).message$, error_array(pos).err_type, error_array(pos).cap_st$
  2302.     
  2303. End Sub
  2304.  
  2305. Function startup () As Integer
  2306.  
  2307.     clear_on = False
  2308.  
  2309.     R$ = Chr(174)
  2310.     crlf$ = Chr$(13) + Chr$(10)
  2311.     po_path_error = False
  2312.  
  2313.     recordlen = Len(cmd_rec)
  2314.  
  2315.     did_not_open_file = False
  2316.     mainarraynum = 0    'no menus in file menu yet
  2317.     init_error_array    'build error_array
  2318.     build_ini_array
  2319.  
  2320.     init_prev_pos   'make sure keys are there...
  2321.     
  2322.     fname$ = ini_array(13).setting + "untitled.cmd"
  2323.     If Not kill_file(ini_array(13).setting + "tempfile.cmd") Then
  2324.     End If
  2325.  
  2326.     startup = False
  2327.     screen.MousePointer = 11
  2328.     
  2329.     ret_st$ = ini_array(12).setting + "manager.dat"
  2330.     file_num = FreeFile
  2331.     
  2332.     On Error GoTo err_pass
  2333.     Open ret_st$ For Input As #file_num  'no error check since done in check_pass
  2334.     
  2335.     ret_st$ = ""
  2336.     Line Input #file_num, ret_st$
  2337.     Close #file_num
  2338.  
  2339.     encrypted_pass$ = trim_null(ret_st$)
  2340.     st$ = Mid(encrypted_pass$, Len(encrypted_pass$) - 1, 2)
  2341.     shift% = Val(st$)
  2342.     
  2343.     st$ = Mid(encrypted_pass$, 1, Len(encrypted_pass$) - 2)
  2344.     current_password$ = unencrypt(st$, shift%)
  2345.     If current_password$ <> "" Then
  2346.     screen.MousePointer = 1
  2347.     passform.Show 1
  2348.     End If  'else do show if password is null
  2349.     
  2350.     ReDim cmdline(256)
  2351.     ReDim state_array(256)
  2352.     ReDim ch_params(256)
  2353.     
  2354.     mdimain.WindowState = 2
  2355.     last_line = 1  'start program with one midi form
  2356.     cancel_pressed = False
  2357.     new_file = False
  2358.     screen.MousePointer = 0
  2359.  
  2360.     For i = 0 To 1
  2361.     mdimain!mnuEditItem(i).Enabled = True
  2362.     Next i
  2363.     'mdimain.mnuHelpitem(1).Caption = "&About " + program_name + "..."
  2364.     startup = True
  2365.     Exit Function
  2366.  
  2367. err_pass:
  2368.     Call show_error(1)
  2369.     End
  2370.  
  2371. End Function
  2372.  
  2373. Function strip (ByVal st As String) As String
  2374.  
  2375. strip = ""
  2376. new_st$ = ""
  2377. For i = 1 To Len(st$)
  2378.     ch$ = Mid$(st$, i, 1)
  2379.     If ch$ <> Chr(32) Then
  2380.     new_st$ = new_st$ + ch$
  2381.     End If
  2382. Next i
  2383. strip = new_st$
  2384.  
  2385.  
  2386. End Function
  2387.  
  2388. Function transpose (ByVal in_st As String) As String
  2389. 'performs tranposition on in_st
  2390.  
  2391. If Len(in_st) Mod 2 <> 0 Then   'odd len
  2392.     in_st = in_st + " "
  2393. End If
  2394.  
  2395. rows = Len(in_st) / 2
  2396.  
  2397. Dim trans() As String
  2398. ReDim trans(rows, 2) As String
  2399.  
  2400. x = 1
  2401. y = 1
  2402. For i = 1 To Len(in_st) / 2
  2403.     trans(x, 1) = Mid$(in_st, y, 1)
  2404.     y = y + 1
  2405.     trans(x, 2) = Mid$(in_st, y, 1)
  2406.     x = x + 1
  2407.     y = y + 1
  2408. Next i
  2409.  
  2410. out_st$ = ""
  2411. row_num = x - 1
  2412. For i = 1 To row_num
  2413.     out_st$ = out_st$ + trans(i, 1)
  2414. Next i
  2415. For i = 1 To row_num
  2416.     out_st$ = out_st$ + trans(i, 2)
  2417. Next i
  2418.  
  2419. transpose = out_st$
  2420.  
  2421. End Function
  2422.  
  2423. Function trim_null (st As String) As String
  2424.     st$ = LTrim$(RTrim$(st$))
  2425.     end_st$ = Mid(st$, Len(st$), 1)
  2426.     If Asc(end_st$) = 0 Then
  2427.     st$ = Mid$(st$, 1, Len(st$) - 1)
  2428.     End If
  2429.     trim_null = st$
  2430. End Function
  2431.  
  2432. Function unencrypt (ByVal in_st As String, shift As Integer) As String
  2433. Dim trans() As String
  2434. ReDim trans(95, 2) As String
  2435.  
  2436. x = 1
  2437. For i = 32 To 126
  2438.     trans(x, 1) = Chr$(i)
  2439.     x = x + 1
  2440. Next i
  2441.  
  2442.  
  2443. x = shift%
  2444. For i = 32 To (126 - (shift% - 1))    '116
  2445.     trans(x, 2) = Chr$(i)
  2446.     x = x + 1
  2447. Next i
  2448.  
  2449. x = 1
  2450. For i = (126 - (shift% - 2)) To 126
  2451.     trans(x, 2) = Chr$(i)
  2452.     x = x + 1
  2453. Next i
  2454.  
  2455. out_st = ""
  2456. For i = 1 To Len(in_st)
  2457.     x = 0
  2458.     match = 0
  2459.     ch = Mid$(in_st, i, 1)
  2460.     Do
  2461.     x = x + 1
  2462.     match_ch = trans(x, 2)
  2463.     If match_ch = ch Then
  2464.         match = 1
  2465.     End If
  2466.     Loop Until match = 1
  2467.     out_st = out_st + trans(x, 1)
  2468.     
  2469. Next i
  2470.  
  2471. unencrypt = untranspose(out_st)
  2472.  
  2473.  
  2474. End Function
  2475.  
  2476. Function untranspose (ByVal in_st As String) As String
  2477.  
  2478. out_st = ""
  2479. half = Len(in_st) / 2    'transpose puts extra space if needed
  2480. For i = 1 To half
  2481.     out_st = out_st + Mid$(in_st, i, 1)
  2482.     out_st = out_st + Mid$(in_st, i + half, 1)
  2483. Next i
  2484.     
  2485. out_st = RTrim$(out_st) 'remove any pads
  2486. untranspose = out_st
  2487.  
  2488. End Function
  2489.  
  2490. Sub UpdateMainMenu ()
  2491.     If mainarraynum = 4 Then
  2492.     For i = 2 To 4
  2493.         mdimain.mainmnuarray(i - 1).Caption = mdimain.mainmnuarray(i).Caption
  2494.     Next i
  2495.     Unload mdimain.mainmnuarray(4)
  2496.     mainarraynum = 3
  2497.     End If
  2498.  
  2499.     If mainarraynum > 0 Then
  2500.     For i = 0 To mainarraynum
  2501.         
  2502.         If mdimain!mainmnuarray(i).Caption = fname$ Then
  2503.         Exit Sub
  2504.         End If
  2505.     Next i
  2506.     End If
  2507.  
  2508.     If InStr(1, fname$, "untitled") = 0 Then
  2509.     mdimain.mainmnuarray(0).Visible = True            ' Make the initial element visible / display separator bar.
  2510.     mainarraynum = mainarraynum + 1                             ' Increment index property of control array.
  2511.     Load mdimain!mainmnuarray(mainarraynum)               ' Create a new menu control.
  2512.     mdimain!mainmnuarray(mainarraynum).Caption = fname$ ' Set the caption of the new menu item.
  2513.     mdimain!mainmnuarray(mainarraynum).Visible = True     ' Make the new menu item visible.
  2514.     End If
  2515.  
  2516. End Sub
  2517.  
  2518. Sub view_report (cmd_file_name As String, st As String)
  2519. outfile$ = get_outfile()
  2520.  
  2521. If file_exists(outfile$) Then
  2522.     filenum = FreeFile
  2523.     Open outfile$ For Input As filenum
  2524.     did_not_open_file = True
  2525.     Load frmeditor
  2526.     frmeditor.Caption = "[" + outfile$ + "]" + st$
  2527.     frmeditor.mnufileitem(4).Enabled = True
  2528.     nextline = ""
  2529.     frmeditor.txtEdit.Text = Input$(LOF(filenum), filenum)
  2530.     Close filenum
  2531.     frmeditor.Show 1
  2532. End If
  2533.  
  2534. End Sub
  2535.  
  2536.